CT46233

The Serpentis Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the jade shrine of Serpentis opens only for a perfect tally of beacons. Milo means to find out. 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: 1828 691 -555294428 839656186 563321811 -14338303 982981530 -993110701 -179711912 758449432 55285202 -633097529 428983269 160783092 -964760884 119084535 -834810297 894493591 -533692645 441206110 -450035741 936478258 889811722 674365540 -260307337 -100735197 696932203 909634734 -256491837 854873291 -92817106 -308998397 202892536 205605345 321664573 -246467681 718559081 -378839406 -470410335 -72836315 66093221 -409173088 -604277379 -808923301 237285085 -346675807 -642470282 89904780 318585876 997044382 52434677 218576795 355066447 -738410102 -240939621 343577150 625697651 -80271931 -682856148 713124121 359045253 494736168 763988701 -603757295 -884012712 -238261583 -863429436 -127328099 113034051 505236837 -314884840 766359168 -744845858 -903332726 156312033 -622727765 200838185 -337680090 -5…
Output: 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 997208387 …

Example 2:

Input: 2607 1956 -617389422 -38344544 239332828 473623866 75324128 -449835704 130070307 -589036685 12940269 -124638967 153824214 -92292215 263331924 144857780 464620204 -807626144 852511823 -444054172 487334275 -300125126 -318488467 -759960250 -962286842 -493717220 -684048746 -773530243 839727949 -309210862 -760603087 -760972800 148350156 347726829 279792112 449220578 685131847 -265715417 -624382803 286731052 393375355 737686736 -223621703 -571688059 -357101070 -562174017 471542097 -589910258 885460880 718211330 406839564 -863370337 -166934316 883655303 422921536 301961852 -211097393 540879772 -593065381 455575174 -506890026 -936080410 -735444180 199580011 156789110 86330548 961430336 -199361917 952358937 -20371715 -615473470 574032821 -898948162 753366116 -607235915 164588410 292041609 -48211960…
Output: 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 999559705 …

Example 3:

Input: 3926 1051 -604555089 -404801852 -546243798 -48296327 85102407 948496791 128795509 516306290 -321203 -831736795 320398734 -845982432 28253901 -774779998 -769716335 -249119946 -774020308 -608797402 -198036602 349479810 475612604 -383602821 609094079 466929641 972266129 776432630 869402490 -913568008 -932543291 519659014 54177389 990591666 -696054076 -344822285 -213579120 -191971802 -637278574 -123895277 -953476666 -942831839 623188117 -654460958 -181871089 -335967063 351768693 255665186 -530583789 -139450805 -735331108 247900740 36007084 -188971120 -734006108 -787373743 395535490 -241152434 -673214302 -170711155 -289425612 718016070 -98419130 488560756 -580237328 930907725 -751500609 -692350759 752677097 -969647141 -823060316 -622011577 -765472991 -694836206 769337875 369491138 184696651 521…
Output: 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 996203777 …

Constraints:

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

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