CT64372

Last marks of Chavi

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Morning light hits the floating docks of Skyharbor as Chavi unrolls the day's manifest of marks. 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: 2282 779 -66240095 -96149130 984729622 -809376990 154555124 608302269 205851618 611564052 816211838 304585094 -283510526 -798307075 868750301 -390381246 -517786282 -210899229 -187651808 873697044 27501401 -271059569 232439271 202671959 850804191 -271892547 881331331 -708060142 -197578439 -657286717 405419904 -967416821 90289489 -140473053 -571356790 -144995214 -523289910 -935047803 586266142 346442910 806707111 437643011 -224807633 -61875384 567494434 -560483071 971511082 -542900557 -473172617 -669341284 448628324 -476762118 495368754 122355366 375257074 968543688 -269354283 -649565193 70295389 -598550433 958992036 687268709 954515055 -656014359 -574559898 700893080 398267586 -22524188 -874125744 -320810150 627794477 -177291580 -646190792 -216988091 425528524 -476354542 -568862282 72591360…
Output: 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 999917019 …

Example 2:

Input: 1182 482 715333966 806360984 -421685210 248947810 148807981 437284873 -115724244 -218645637 -436685809 -505342267 -9143817 -239709188 -511001078 409549380 -209561928 -436095192 392549005 436976121 -497715518 226631775 -898411392 -641575781 124008413 -407058216 296723491 -319282202 -469388320 719951485 -243262269 827305787 522670535 746546172 709194862 21242661 641663830 -775452228 115570636 669268348 -509364298 339368887 872113430 -7937268 50285301 -919812092 -360654539 475229746 291063497 380501221 976923764 -492098377 326849137 890609416 -116819008 -430937897 -436121679 -214893828 -800200900 -645432956 -521365374 453041886 534509476 335872355 926826419 -49344015 266838469 -331166811 634409231 444559147 431230358 -901304920 382675444 771278077 -368062096 674809997 56371270 815009747 11180…
Output: 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 992470505 …

Example 3:

Input: 917 74 -812798430 791380775 773662716 -103512557 -974011238 739245396 123700961 -154144584 206089598 759859365 734210806 29427748 -374347733 316507501 713168975 213587868 -96163533 -665080850 -87715335 106698544 -314321154 643098196 -124261593 -609174058 580722351 -794172639 298968119 -856231634 48596601 138615179 999502967 599267065 51959221 -275399509 -791995167 -98881328 939583052 18989516 745477925 938227900 417638312 -467159309 696891165 449377692 -683581645 -926955528 51831162 691035817 -828357998 -208004473 802513158 -710969740 -528478713 -814614746 -288563304 -865945217 115346841 -412453155 -835037634 47953630 -842833254 -892488889 224955376 -687972826 -710347738 -620114145 -164882554 910142023 -437757825 -102445072 529660887 427867584 259968231 -975858878 246377905 307743410 60987…
Output: 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 999502967 939583052 939583052 939583052 939583052 939583052 939583052 938227900 938227900 938227900 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 910142023 893214972 893214972 893214972 893214972 893214972 893214972 893214972 893214972 893214972 893214972 893214972 893214972 …

Constraints:

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

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