CT57283

The Peak per Window Beneath Lantern Tor

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the beacon hill of Lantern Tor, someone must fulfill a tricky customer order. This year the task falls to Jarl, armed only with the registers register. 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: 3379 1368 -762342162 -65525867 -989161333 -25230236 -799167147 -825486367 -398538072 -831293148 -863656115 992271115 -719844813 -979935467 43143887 19335344 -609934931 462209540 555605684 508371483 68784527 17769640 -380266309 -833445147 -328224548 -987336036 -530872327 -694200672 307262118 -371265638 669588882 586959129 -447644094 -362540674 503580214 985749004 597794138 -365040049 -244119363 203953373 770055795 -973807496 647309048 105434294 967348441 456482382 120651797 250531779 -351295277 -635070557 -697298484 907524561 -850538345 -398263684 87225975 -251426744 209708327 52842583 -286732827 91854719 -112901394 125808763 667967527 -541731136 827594009 573820552 -160085809 805033897 -604055461 -560939921 -58948513 790506112 254127660 664290394 134700559 -227692322 264239751 -980636062 -…
Output: 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 996718063 …

Example 2:

Input: 3766 1138 -974911249 -46786097 354129121 -285769402 -74471240 -469575537 -524369084 862734727 158241827 336762218 -953064903 347698288 418880647 992701447 439092078 -790989872 287647957 617435186 66165489 -494186686 -578013775 74436225 927267897 -477968134 889505835 740381316 -132066920 -300496312 969246936 -387670226 -979526778 -687622726 -850328579 -916265423 -175729203 -842941345 -595323840 -329280236 -654499257 -607999854 855065633 529864327 -401208329 -956052073 -164695997 879253562 -446195159 836254618 -436064382 -609079822 894609781 -500695212 -218213230 702620004 105750062 333673957 -287441442 -2011703 -550865634 -525682338 692075044 593486004 579283016 272075413 -363541957 -798020510 602539578 -995351793 -991149353 -930551835 253309052 770606270 -696645513 -9893297 -86043911 32532…
Output: 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 999573798 …

Example 3:

Input: 544 98 400802376 -136781865 -482818758 -49965179 696793135 869787993 742543193 442048714 417153286 774153970 -56504954 415153492 -65617647 839284081 -419786472 371493197 575351417 -44017056 80051095 -745654441 -272366075 406944363 324022901 761562947 -652885998 965118712 -538560816 823961895 -949505845 -544284026 -548152167 -441050936 -972328173 289774437 -931020916 -822343326 2426975 -904696419 -717918835 411587296 615443970 203173329 -449416647 -499718454 -170979136 -264465473 213296124 949662539 621341377 665327785 -328194412 262970121 -339032868 -398518647 -735108683 -460419275 -349954778 264748237 780600765 461026105 351136625 -912506022 -504775934 349141638 -282453350 -765069728 600354945 236203981 262446334 87564505 964586290 207310488 377870929 -617004504 -845574212 -560009100 6597…
Output: 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 965118712 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 992533906 …

Constraints:

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

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