CT59871

Vesper's Peak per Window Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Vesper found an old ledger of registers in the greenhouse attic at the bamboo terraces of Verdantstep. The margin notes pose a precise question. 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: 2487 392 164994855 743011492 -446427226 167718722 -899690064 622726112 -55784762 -880892183 -253952391 -808444981 880365375 -970238371 -775466399 884892600 -131315826 999160144 399640133 329100890 -375741876 4095483 1618545 -181476898 -417363707 344828423 -607483894 293751513 -108816793 184303591 536015794 423086951 261898144 -177605575 -224239634 418320610 -913265810 113986180 695840851 -498782234 -844520018 -242573499 -164221487 -86438787 974905268 283961033 -79408413 -707070187 -638162082 453527488 -455228208 -300177468 100032542 393239567 -1378011 633112575 886462474 269347866 415508345 -223756590 -480076735 -69333784 -879801393 462852720 -590329034 185670300 -671284638 579915410 -573903270 -500882867 979395378 787360194 959339577 778569000 7761267 858467762 -787877447 981394445 416059…
Output: 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 999329212 …

Example 2:

Input: 511 58 -345512522 -298500783 857251556 485859780 -634356305 715694025 504150239 233813699 -178009234 -871645895 -152361534 550410090 859357673 -229606808 -327813818 43976496 732417772 -850674435 -992220317 -138075432 -420098432 -678088813 -696254877 174937659 -647537053 -798965450 -754622542 92894124 478280717 -847096365 -729152343 -745873526 -848884314 867195363 126193440 -427249892 -834953229 -129742663 -523386965 -445950154 425047962 135458655 -867322126 -980910549 -426875674 155617091 418853665 -198104110 -402034145 696867813 487982330 76134177 -41815929 -280647943 230604455 798797677 304633760 321554174 936770884 796768483 -34561809 324332354 -192950875 67010040 432544746 -439288355 -724837497 732453254 127837089 854854495 -490900640 569126708 770653643 637380126 768220125 150026063 -…
Output: 867195363 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 936770884 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 942835051 …

Example 3:

Input: 298 25 125693800 467925082 856847720 -238858012 393870875 -197391478 491439025 -385630767 -94621746 402961766 855035049 -660912490 373147425 967295811 733748214 -803893542 290068365 -198252273 784959742 935148986 -66672489 -809695973 -754229741 -527259117 -270923350 979696245 78400724 49056045 285838889 -885112584 -5629189 96524063 -92342824 -980882873 444310041 -817174607 -581919366 -489933800 -680898653 -362515187 -908701493 -584780112 -70457131 951804507 -118418296 -49724814 907734059 -414186326 -218985482 69837465 -990665791 -523681971 740663034 -54144501 432116355 -569286501 507657298 -487407018 141237273 527026195 -71546756 773617113 461467375 -192425646 791903854 180389061 19189892 362621852 177903447 -798916485 9924362 146671831 -486758794 -207831284 838105014 205270087 -372638750 …
Output: 967295811 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 979696245 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 951804507 907734059 907734059 907734059 791903854 791903854 791903854 838105014 838105014 838105014 838105014 838105014 838105014 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 932591982 938183223 938183223 938183223 938183223 …

Constraints:

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

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