CT47750

Gardener's Bronze Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the tundra station of Whitesnow with crates of ledgers, and Gardener the cartographer must account for every last one. 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: 2238 1942 -908672857 -438789889 711929504 -706082950 58486144 263421700 595074954 834514723 -880712246 968451322 275126859 872948029 -908066860 -86886345 -652236775 -832710797 -489170244 -148800797 -233176591 407140151 596020771 102283352 -518210872 -888528284 517863792 848788670 969486189 603117513 -219015007 -141411303 -860769234 -397951841 -593489057 -701858651 -759025911 -576585196 753362372 312154037 -699330656 301661134 -315510825 980091746 -60135485 -275319515 517619303 -460227648 -128492015 -224689794 -129430657 577373106 943033984 -757455027 -141153387 -499487337 -683522974 -635510031 -170946282 -323316431 -321130209 -197156120 -240311148 445251359 -162880262 -67974546 -456044338 983865714 -938656494 -69807281 136345195 642560101 455470295 -472675949 270549982 189782711 -46458796 …
Output: 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 999810906 …

Example 2:

Input: 2409 1756 -837600187 -966572758 253922982 -755219675 567490982 517350533 -301179551 -712007391 -159259513 426360825 319114912 -336637572 -149948976 -974521499 967126635 -525797674 -164606310 -745976262 749222462 893184548 490767892 -664805901 575682034 416699583 735760788 485093394 -997107060 -487496103 -737095370 352209536 -586387828 -192449881 284365728 17549272 -135655361 -553389308 -257818194 -752422983 -187119744 -486522578 206234041 -10430161 -237402149 -298447177 -989331056 -156579183 -228369000 142510025 -923240212 -474772871 -871846260 247635600 534762719 6518887 -880833873 627419449 -616903312 890766369 -28107698 684718999 -203652367 190691625 -7705795 830821953 697273648 -137580816 374937187 -291154486 -615526019 957374797 -317517194 658592422 800517709 960205491 214330535 96650…
Output: 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 999411370 …

Example 3:

Input: 3172 1636 481473571 40272493 -845765440 702193673 -898723924 781932390 924451678 814347038 -17944732 744438925 -6661434 898964334 -983134627 21187174 -932324633 -548557814 385765534 -897615720 511028553 -367171464 593048927 -329952554 -756112921 25090446 824333317 245574596 697919826 594347752 412720825 674645101 465386904 -559477716 527205284 -927109136 77954084 -500343535 -581560640 787875642 504221491 396656581 441048744 -207728265 686115006 599931491 -54091173 744353278 -691760712 283644555 313992529 -70995292 -797789411 -127362070 -716005917 -56768813 -945845761 450955944 -330917530 -714486109 70374881 -733620026 -75723645 798935897 856301441 4665731 343835260 -32656920 688306507 -845958142 -438846184 -547373652 314258734 -631847029 -733112094 -276127741 -107597116 303183491 446197212…
Output: 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 999303617 …

Constraints:

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

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