CT45033

The Peak per Window of the Scarlet ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Morning light hits the trading post of Goldmeadow as Vigo unrolls the day's manifest of ledgers. The tally will decide the next shipment. 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: 2891 2539 528552550 -782355726 -10227945 -854959251 -356337738 -588524580 546329061 387420766 -178986374 -726225368 527927699 -815356141 -509982005 -208099607 525012609 904585792 164512222 -849983719 -384429085 57605970 -110812731 105781688 57672192 454210662 -56329930 -53356546 -717903287 561609496 -974889016 449934255 310314791 -201017407 119670056 341209987 684781039 575645708 507463203 689557081 929033615 -12050506 -688485203 913456585 398150150 343557425 89745894 -75394366 -261140467 -217911700 -823971229 683616048 11849187 749791506 -888853959 -225007415 627298002 -20976818 731112252 968525535 767542052 -218579675 734002888 952234147 377813851 806327042 205285156 -854362510 903135559 79930716 236934778 784187063 235767898 -298789867 -630346755 -952471986 13526625 285075416 -923805368…
Output: 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 999912542 …

Example 2:

Input: 1443 1340 -135244650 960994471 -493977941 -442297964 684237052 960937640 -381820808 -375462140 152023378 304774433 857290334 -633832907 225343646 -110115305 288179023 221017808 844879137 -851514889 -912758680 -780756324 854521911 581867617 -567714462 -633937699 505555138 897875510 -833826202 -619934899 533384006 -862883266 -930988439 118894655 -266274320 701652770 810650028 417999737 112641315 -162160394 -708647517 738166169 555000444 -93050871 -590451410 585196099 954526413 -858216518 -583562329 25824949 -269176590 350497399 904949603 -716273103 21066915 173345316 5516357 -760141607 -506498909 -159880453 -795873455 768926199 971713977 150789950 -6122597 287067824 599360115 955558999 -691575391 356923540 -286486674 -476404177 504767451 809160103 -670713765 -682516834 -251300718 981684510 -…
Output: 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 998291361 …

Example 3:

Input: 905 529 -552359170 -234964121 881101281 172150221 74710940 -651264064 -470382391 798436367 374106146 324699614 458847283 614451497 -901681346 -758865600 577404853 -15825749 -502979671 -700917283 576171480 443603356 69921597 -31544535 -529874023 -749566252 5514557 562077672 708003190 -77658248 -504760569 -791865608 443003943 356937195 -728812388 -866941402 -67071261 -917936095 -253488564 383246412 997508374 -239991412 -834278519 -416664509 984925227 -875469173 -653299838 799765197 198127232 816302843 -434844052 275674210 -735911576 -482349019 -944624029 419030918 -275841970 -319578553 -867898284 690427516 -118911083 -185007769 413688442 220278277 -85794700 -225493029 878972660 613852462 -199172102 131835724 597368649 678651467 -687670351 918286230 803590874 -685459776 -293733307 725834232 -…
Output: 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 999634399 …

Constraints:

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

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