CT62199

Last beacons of Finn

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The paymaster Finn has been asked to reconcile two mismatched ledgers. On the desk lies a long table of beacons readings. 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: 2740 1162 -890380597 821647090 352349370 696463448 882781285 577770107 922832629 167314947 736130945 109548717 -333949694 740612967 -994956019 994628638 -37346179 -266548025 47239026 -468865275 -790469668 274169704 -300705177 -153502936 -383884948 -338827843 -802949197 601437169 647793629 -459043535 -408460232 274800043 -638633588 513861524 -452365725 -215265098 -907377482 14957547 920132616 344413452 -761250648 -331406477 560281749 -928484096 873090027 394119502 -250326700 -30481097 -212283871 761444495 736377998 -415410563 879718920 -571260547 530360639 -16115376 -265528753 656675285 -327266363 969728192 -629374496 240358225 999691502 336499716 -16289624 544372637 -377416240 -385470743 -231553787 -532710357 354451241 -119994572 853662691 -653257840 593807972 -957084905 523456153 89670611…
Output: 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 999691502 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 997532626 …

Example 2:

Input: 1974 1780 318337624 586861326 -949832489 -622537729 -75550682 626150947 833212652 -782527897 493435286 -311037887 31201730 929363817 -709696080 180756404 124732 -176078458 852773279 -245392465 -511265773 -971736154 495726950 -213377373 378630005 550907854 -468819398 98414238 609121520 -320866478 944062850 925909402 -342785209 -450063539 -838372774 -212211266 845919248 708034740 420320295 -17622137 -835011058 717483045 600769257 957607604 434385931 108644631 772772765 -526176542 -854299153 -258833674 -79301690 -942092650 -961560504 945120583 586116345 47572030 -305857797 -561208059 797398929 -891153658 -876799927 946798918 -470243610 -859172042 319236609 761133909 85840384 -467178168 55591073 -433473411 -151687051 135119002 138585195 869362874 813033078 -940790996 999711452 -86946995 574016…
Output: 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999711452 999092956 999092956 999092956 999092956 999092956 …

Example 3:

Input: 2777 2114 -474873933 -670103355 792695308 246344262 726414122 -700546229 -619419750 684721508 371222164 654752399 6002709 2150374 -349283944 -614758065 -210923595 3399047 622809629 547607045 -345697192 -764984986 196577243 729789571 441030302 405428036 -723235745 -399557503 563199808 662706318 -986762481 -212146098 -621596064 -175937463 578184206 798600653 -739689667 710795706 260966250 231811941 978419129 228667586 283067195 337210799 580602520 520050172 -3928871 120282043 -401521116 681410729 -660027043 808856682 -253080309 -437567073 95983557 -475819174 -245438585 787250711 -829280189 48868355 -618238246 30161880 -582241043 854922478 -393230192 -457622878 -244607402 -297764846 227143862 316781011 -73855467 -861539363 879256770 -781180832 -591262805 122037100 847520309 -800962341 3555542…
Output: 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 999776316 …

Constraints:

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

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