CT38278

The Bramblecourt Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Rhea runs the gallery at the thorn maze of Bramblecourt. Today the books show a list of ledgers, 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: 3136 1854 -405907387 -323897002 -90132763 497653481 -363355390 405799082 179234296 505179765 -805083820 92789434 315319940 415343491 171007595 867161429 893616530 901544866 362967538 457089580 -511362635 -422561729 -494953438 -489234443 42381384 -433280700 -399910897 -635742308 -362612120 -192148189 884973074 -467382400 -113646086 -202596530 -609204939 7238723 -22140997 -397922189 571701405 -40514614 -828444910 -441824672 -149773282 461244961 349950701 -217288415 -57639513 649656390 -241264335 986632796 -313527518 -420455754 -49988985 -146166861 966590375 -727774534 -392572532 52134705 602197455 -750217150 -964750542 251284538 -806694443 718701005 444893697 857710286 197145635 -232307079 -939098635 780241344 256280488 -559369838 538946113 106976637 503230529 323802547 -414945644 -249582343…
Output: 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 995518703 …

Example 2:

Input: 2088 1035 766194879 -225462244 -859862388 -760838911 -503218661 752804705 514113958 -584493494 733577433 -34525057 905051032 -829096236 551194995 -34972518 235131021 960858531 74669411 285673553 727240191 -856092417 -631765102 706315413 177320597 -107566960 466344800 896482999 20873556 564493923 14729721 -444643812 -386986120 -351548931 -621456675 701279912 -156200568 -299205615 703847705 527869741 -760355014 -995960066 410989702 211470216 -717732971 483611168 560467552 -827388151 229034155 -439217712 388924323 719503043 911936100 61147135 204161695 573142457 -951779586 -316500908 949949953 -161244050 -353552800 -534161862 726306883 -38218550 -938107695 477449480 29149904 816203152 956287211 -593450603 604649925 -381196017 502743017 -195718051 565119094 376766222 -658240298 -124823831 3569…
Output: 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 999951641 …

Example 3:

Input: 3127 3005 -523063736 348467531 193420204 452316731 -164857049 299280433 773892630 -775542461 515949670 388352217 638312690 -104188406 -466972391 -663219188 966246416 -317834581 572444374 774227919 -727921794 -646621941 -891596667 325650614 660563201 625244395 -156973689 633055469 -862416455 43210320 344324860 352162567 -285222115 -254890990 -718245444 595717279 -67323970 494293041 967577141 881059584 -580346720 159313111 -779921965 369878384 -26310973 787947364 -822678404 -684351338 -83868603 761868961 -919472128 -549643978 -464230406 -844328001 465540005 -211340973 -750919766 807029270 -907163043 719377758 144055169 191304463 883871710 -676395599 672540416 262128166 441375630 -508048165 568278978 -863038742 -513464608 -552700860 -792524331 884454418 235689965 921124142 613687530 -45491021…
Output: 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 999019628 …

Constraints:

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

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