CT60505

Gino's Smoky Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Legend says the vault under the poppy fields of Scarlet Plain opens only for a perfect tally of registers. Gino means to find out. 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: 2349 1343 938285370 -345291317 -420748686 -374774203 -771946846 -387950247 779407760 -484941133 125908114 135055681 -347831441 985144862 977378868 -460443989 -285683410 550964515 -752801306 722261647 981261392 -831254199 573435125 808656920 471080799 -95597500 -219232570 -864486687 -14015636 156703620 -560250341 -403731693 -428132069 -432478872 -722651138 -927912691 -901237814 776210247 391954793 -707009465 842015257 -773376972 -709432739 198550993 862160419 171193377 114230821 -588759138 452985671 -507096333 -649046160 -180936830 -778298144 -930906331 796803307 288210872 220784866 -210166183 -651134660 -22153019 59385967 400676882 870657485 596154410 -524562152 708024111 -148313856 -324081708 -821371852 45217440 93689994 540262314 846281259 267962364 -162983281 -155739101 -982529507 -7012…
Output: 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 996202540 999290757 999290757 999290757 999290757 999290757 999290757 999290757 999290757 999290757 …

Example 2:

Input: 13 7 -278254471 186195385 121901339 279148302 -519979248 934362453 32405722 -697931802 158455714 -72950864 542560184 66340475 722925752
Output: 934362453 934362453 934362453 934362453 934362453 934362453 722925752

Example 3:

Input: 1848 1402 -607650250 855178454 909496239 -897464423 96893251 81217730 -902245991 991261521 245798289 -308428579 610123511 -996455378 -20161474 770116760 90235656 496117317 975170262 -679276544 -812532978 -942020925 698877996 -213495550 3765217 -281369540 578779564 -12516420 16193560 -181074376 -887925459 852522030 956240162 735124097 -291949968 537480609 568626488 -257042352 -608314741 -33645512 116239285 339356700 -94649818 806836686 14796468 -999871568 789190180 -22598259 -981137576 508726956 841641849 -90357254 992665221 -832743884 -144407773 -168175452 214172518 -591889091 -629644454 -839767017 972550209 906690431 -847549848 153554514 118469041 -9684653 -770867235 246128396 799311830 -530079559 755831641 609778322 915118491 182918218 495656522 965448253 -794456924 905804317 425686654 -…
Output: 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 999973191 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Gino's Smoky Ledger - MEDIUM Coding Problem | CodeTikki