CT57603

Forester's Ledger of ledgers

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

In the forest village of Briarthorn, Forester the valuer keeps careful count of the ledgers. file the annual report, every figure matters. 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: 466 371 868582555 -621016433 798886670 -102342377 903413618 -441104671 -297259658 -335914179 -136303699 404541789 -68413968 103699796 694585837 -697471050 -54682435 594426455 548767981 -360155414 640330412 -168903932 -241287560 713302369 -255543977 -178037189 155976930 709982590 902885770 -824287730 -600992039 447761784 433395907 -29022935 -26151274 -737214967 -823087289 -385808898 -357980203 -253031878 -158365238 525934949 -558763295 -499416890 934360712 841229546 886514501 336386728 904878023 970674008 38524062 -799595647 -938025991 -117682159 479875542 387048133 570589027 -720329452 779506280 588744608 703676512 -430367614 300837363 682146805 36001541 -777897286 -38454820 -384246376 31775288 -878484012 -724076001 -344381659 -358157957 -624338108 461715515 178960112 -635237484 401603204 …
Output: 980143179 980143179 980143179 980143179 980143179 980143179 980143179 980143179 980143179 980143179 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 981320867 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 998633983 …

Example 2:

Input: 903 9 -376486912 481475504 -647874570 -341900505 972813364 -972998544 -693177596 -959267413 -564624526 195633281 362077630 -430324257 -342939096 -378564276 -836227056 -432189801 344892495 -434048059 989986837 761615941 263706503 -678893380 340685814 -630001779 -343747967 915780567 936148742 -644135172 -834872635 -585773847 458612017 -782261132 -672066590 -906111751 -99890925 -437654845 708470116 304752874 -436939487 -299972481 48029482 -776720970 745788894 559034370 -221586377 -870916585 -310186093 479268593 130060324 -619682782 -658176543 440003816 -244181439 641770847 394957302 -895085449 -677635455 605883080 48168519 -375906374 -43663044 468172110 610426340 525639701 987622583 842807663 -962514266 438366037 -244577097 -231317394 916534392 420239444 -498391719 181514490 -326495042 -33024…
Output: 972813364 972813364 972813364 972813364 972813364 362077630 362077630 362077630 362077630 362077630 989986837 989986837 989986837 989986837 989986837 989986837 989986837 989986837 989986837 936148742 936148742 936148742 936148742 936148742 936148742 936148742 936148742 458612017 708470116 708470116 708470116 708470116 708470116 708470116 745788894 745788894 745788894 745788894 745788894 745788894 745788894 745788894 745788894 559034370 479268593 641770847 641770847 641770847 641770847 641770847 641770847 641770847 641770847 641770847 610426340 610426340 987622583 987622583 987622583 987622583 987622583 987622583 987622583 987622583 987622583 916534392 916534392 916534392 916534392 916534392 916534392 615743495 667613914 667613914 667613914 981709140 981709140 981709140 981709140 981709140 …

Example 3:

Input: 409 129 742387627 -55815870 -34533882 -583863619 -175422407 -992430384 311065755 447940636 -62494100 63169375 -388469306 140674520 70938608 993226443 354758198 -823751941 -287285522 -215244975 -696661633 -979621113 977410774 -735283513 798402087 101791856 534399097 320132445 991974186 787461533 -745518410 -38223427 549841155 403106364 967557873 98941060 92629069 213893562 290262000 -361470127 773344399 -354571949 146878104 -562720746 -53266584 -73518429 530267883 -886137536 -465193489 116217822 -386438348 360434856 847414895 -554786691 -758892585 -153836637 796717334 772295096 565423990 343532745 107118852 -394207137 -20943314 -49737598 134143076 42087748 619672985 862509896 -610359261 705228491 -171808642 363720691 337070065 -548502424 -161253693 238155279 566806213 -728633421 680211782 9…
Output: 993226443 993226443 993226443 993226443 993226443 993226443 993226443 993226443 993226443 993226443 993226443 993226443 993226443 993226443 991974186 991974186 991974186 991974186 991974186 991974186 991974186 991974186 991974186 991974186 991974186 991974186 991974186 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 976067134 …

Constraints:

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

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