CT37735

Viktor and the Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the kelp forests of Tangledeep pays by the answer, and Viktor intends to earn it. First: the full register of beacons. 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: 2202 2028 -13786820 908942717 -664655891 -650894103 -16960330 559482426 -512314314 151653524 -644324616 -682414836 -708816726 -362572761 369148839 -54011385 -899205214 -57595373 119267015 227713200 677919214 -624444163 486653202 -37438524 -987655506 196958922 128781717 784934392 -305237589 753178400 -441512791 835148448 -328582332 172133234 -698892371 -350931756 -880048297 -188869570 61066002 -522704127 -552228257 -211904991 6954458 -225669355 405042879 -610197858 -797210268 -459808820 -811921749 -226177451 -618575176 499912947 -14975990 634790166 54567953 757329806 845237874 -512434829 38537746 207299040 -250868973 -150599074 130422728 875764286 -949423121 386950502 306827202 -65051738 344366563 -36322161 624113598 -869912786 155786443 -498721216 60520240 37263951 -442560372 -59202508 956…
Output: 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 998833224 …

Example 2:

Input: 3201 550 -446008431 -541293134 650725461 -61601264 22462023 838889676 14823881 -989302460 -999307325 926382671 -322966745 -20076965 -685935911 303562277 -280447885 -767021850 -787216540 258805832 991769668 -198290642 -112747963 929953868 112934353 -953253558 -436348908 -230606572 -773148141 -945519470 -562119216 -676146448 -628697997 -603271363 123362964 336073980 -903434665 -128068720 347139788 -447071302 339379258 25668662 -629948002 -83813447 814824324 110229063 -413247210 -777022118 -618438210 -463161283 8929286 -101940387 -40396614 -48703679 491231717 527728001 501135028 -126029168 -93172204 514964493 989760824 -146628913 791632488 204024668 -701661793 437805380 -527977185 187410010 -681559212 -330639692 -256776593 929249017 -984214878 707659773 303178124 -599390476 -367731159 5092196…
Output: 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 999248276 …

Example 3:

Input: 1289 1182 262118652 446345601 -917343162 -345782461 -562357415 -957754556 -731026942 -918558188 858596572 -467181356 438586830 713468946 -568407411 -356996179 307962821 -903577081 -544649351 -992060859 -171282117 -218095948 -328332478 -154564940 -711143275 104458000 -459931479 38134544 356722395 901726204 867436567 -462953791 863863965 211034248 -321795154 453157847 769633068 -434304357 -708236011 408151883 576897055 296064863 755578438 -487069740 -480313073 901487997 864481223 898504921 -34762990 -422483253 891557084 -121550672 323939280 -466014455 -230344370 779357182 520487715 -926979460 -930926513 -257519199 -538839385 -140748749 -370131762 82295777 196398350 187351572 421705547 173491548 -416868006 521503726 -322168087 -560519181 -708703774 -550095777 469401614 -822282778 -553457482 -…
Output: 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 999172210 …

Constraints:

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

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