CT63337

The Peak per Window at Amberplain

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Rhea runs the mint at the savanna camp of Amberplain. Today the books show a list of registers, and the numbers must be worked out before sundown. 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: 2772 717 403324180 219624173 887440187 -904603587 9437810 -369255257 -439820929 421770561 387433812 -908049583 -27905875 212854081 739208883 37175256 930778993 671739595 -319514308 278470437 -327298024 -810113666 629866858 42845447 -668730774 420887966 181273167 303080838 -367647661 530779670 161808709 177113234 -123618900 325567333 438366447 560155221 -46001991 754312200 -784025428 -690648659 924618633 95068462 435971021 998323787 588462263 -899782877 -831328831 -894252260 -638592944 811641837 819718184 886286989 809982609 -374117975 745586005 -895789198 453328608 -781782382 867241206 -468164894 -522222069 373730181 -39402730 -19329703 210935278 -212209251 -395547788 -548494795 821487213 -378076751 777172747 734701536 130249245 -191303310 -493477237 -118279984 311392928 742107587 -4829812…
Output: 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 999084572 …

Example 2:

Input: 2608 1355 -192055470 867112631 -299201008 -940806333 -859741099 -85946000 845460243 -964228339 -977086648 -36860215 -404263748 515223605 875417154 227447713 798506980 -401879766 -596800527 362098376 -648132270 254375505 968285646 -995299548 29024401 965194908 535853384 718057695 -578467036 -233696238 723741897 -471560750 -315527030 781305690 408344695 -455321233 295590302 77951860 -931218110 186023491 -664819102 382646608 -648198739 -588685832 -810117955 -433178607 368909966 -894335541 -299863444 124116536 -836783678 -658466245 808263727 -189011599 860052331 440960251 -436492567 256216767 343107171 302691172 206815564 -737793773 -378906660 71475117 -516958605 -22553907 410027483 -428847800 -872067608 570169469 111592889 -660531230 -884159013 347200316 -996156588 334685422 -647627607 -81091…
Output: 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 999310147 …

Example 3:

Input: 2923 2147 837872872 454825252 -634130910 356803761 -496052392 420935496 -713804071 428944974 13028838 -568694757 335847816 123747599 -668226442 -756697099 -200142347 541435034 -655028644 -315052044 -296842318 482892351 56192495 578511753 226676579 -84749328 -916944368 702316142 447573229 621800905 970139454 -761906200 255646941 637298857 -394977454 211038646 -815424919 4421043 -35034654 885177017 921961963 234485600 857733541 -744333636 -737248968 -559999467 -59711486 -141193336 -271619243 -49049245 881288252 -765009330 -872196035 -180152512 -647738082 -324589250 221785629 -666375708 -534337158 -499066728 -876009409 87564371 324978516 -875712250 -59910602 180931596 177771646 -110822972 50523334 764353609 361469817 -499284948 590401772 379537476 -777010465 624872951 -166453297 -199761601 -4…
Output: 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 999691365 …

Constraints:

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

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