CT58046

The Peak per Window of the Golden beacons

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the mangrove channels of Rootwater. Arjun spreads the beacons records across the table and picks up a sharp pencil. Task: For every contiguous window of length k, print the maximum. Input format: First line: n and k. Second line: n integers. Output format: Print n-k+1 maxima space-separated. Constraints: 1 <= k <= n <= 4000; -10^9 <= a[i] <= 10^9.

Example 1:

Input: 255 47 257860075 -387595811 779904444 170018721 403095216 581849614 470132079 617577526 969502054 -246988718 899419577 7609771 -315783354 -696238652 -311437017 -814941561 125907263 -781210604 -608373831 175461541 351818416 -833916241 600250113 604886923 -486455070 -528197413 184852113 -922477354 326448614 879087885 106197249 759965079 580399512 -85644864 987038010 170128604 -598473841 62674934 296376873 519131870 -572393282 576986246 40930147 174432330 276940469 203417056 -933287785 -991430200 297257759 249589232 -735556243 -276109410 688472610 -13294368 -567003183 113861497 725411172 -86825060 -145915309 87000099 -582804323 760975260 -666124454 -678067782 -639455348 958320371 -610635782 806935311 -360012525 -635563586 -511066924 -147677857 -638864481 -494423551 763997345 129356013 -325942…
Output: 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 987038010 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 958320371 953757075 992329553 992329553 992329553 992329553 992329553 992329553 992329553 992329553 992329553 992329553 992329553 992329553 992329553 …

Example 2:

Input: 670 252 696473813 -145873853 24779722 -270453912 253034661 -777088810 191607099 71189986 -612706515 -78443158 384824273 -467514237 -708037878 382772299 480822346 358775162 431040922 -261161312 21339001 -650005080 189353572 767429016 654124630 -762572022 -658646836 872146595 460298394 -344709465 194600298 929504140 490961403 -509560926 622928205 -601792599 239449997 697151456 781680361 6477321 335523401 -134623153 -997931160 963748359 8619702 -58507749 -648731520 -818878590 848685636 502548310 -389126080 869153520 133267879 -302599240 -207067455 112958555 -456463824 445056424 -97056506 608697172 -792971430 648952089 597267433 -915087558 -960513524 -691271145 -216685465 -879760730 -212337748 -29688886 -486458858 -402779789 -236838192 404140081 -400181921 -539443946 -584260456 896487290 -1192…
Output: 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 990222310 …

Example 3:

Input: 1098 1074 -153389350 -122939704 -9385041 813648246 -313170435 608648133 385072137 -378441608 -722393154 -707848998 -714078738 -592865687 -957272917 -496871623 495005756 249316466 -648778947 178548509 524993955 -288782029 -922188725 141777076 555809627 295448192 -900999326 -1827372 117798871 -309877952 -811715145 -162342350 312201981 -26589658 930306928 -341585116 -659131555 296912198 514387855 395729212 -392726482 -590683061 385782264 -876810063 228748951 -261009046 -562518622 859713253 871101832 -404493281 -58396255 258065182 -453771607 -554373306 -563462617 944812081 582995770 -537166632 11218371 846666783 -899437725 432499415 -790229782 -193798539 -555398758 -697777275 -232792742 9568219 459008845 -695601347 -205951604 385048978 -734320190 712492269 -734234629 833693220 -545107679 64661…
Output: 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049 996892049

Constraints:

1 <= k <= n <= 4000; -10^9 <= a[i] <= 10^9.

Loading...
Test Cases:No test cases
No test cases available.