CT52172

The Peak per Window at Fungaldeep

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the mushroom groves of Fungaldeep, Cleo studies rows of marks entries. One clean number will settle the guild's oldest argument. 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: 1334 705 192511001 -746095573 -581805829 -939425680 -512540358 -77581837 302130640 939681299 -493247305 -798154466 869465252 -130283876 -556499505 743290016 -181614692 756486664 811198699 -360013457 -170832262 -779882683 310606454 -511208455 651366695 -573889204 685048851 -955101937 263179463 843168302 -75573411 -994460998 -448297677 -654994602 900744782 791883882 -904850146 -25538627 557500596 -256055123 691673746 -977162371 -879896549 988417022 -335235214 -695657991 389383971 424362939 977785601 15453749 -13222950 -539230170 893111984 -754096947 -599756186 -431976972 374660145 -437302854 -639514439 511680359 -332959996 -964333437 -72382852 -925012141 169843701 429931628 -865969427 -410834302 -508068931 -376702760 795927874 791487822 -139148693 -101177128 582181820 595243546 -683476268 -1…
Output: 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 992911256 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 995180069 …

Example 2:

Input: 1992 987 143636006 462964901 811326138 -700139945 463362370 313745099 753800746 45702052 112703865 -767493100 -996579006 -932814332 -402690475 -264044502 -854955717 -923844819 455411764 -755458884 819687592 -437345860 33374669 -76436808 629598875 -178529329 -28271296 -698401660 906902711 737125690 142159754 -130836561 -821778770 923221071 -575144407 -372578070 -55726506 999840562 630931732 193126347 -353755973 686552198 8302391 -12088272 -8138071 361712598 331007241 -218647317 -847477790 -638331641 -752692283 -894625297 96931799 -651537519 -235531273 432825299 399932779 84491072 675115014 -299628970 -613072156 23993280 237494237 -376051023 -676937577 56008937 152669293 818941951 -362694102 -566352836 -178557358 -386701160 -506011526 -263573092 306357435 -449128088 861590869 90686022 -28098…
Output: 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 999840562 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 998399070 …

Example 3:

Input: 1303 25 -348535343 339879806 832754426 -612195150 -663846068 -942249684 -734489764 -505709435 745262046 -297782693 638314029 -497586246 366926249 -582598437 170161897 -113289249 320630197 -800698241 568324918 -413723159 -40947813 -449423632 -108157044 -655879524 -975724782 -252301319 833418303 592699432 -271448557 -683953094 -861920557 -703403926 858923932 855163864 -793613902 -482798630 -935735860 -24227179 893454522 389967604 363591892 237893261 -492431644 976811053 231162285 -500733451 -350866281 -509782047 -737840176 642165239 -561503865 854668658 254124138 -580950808 -951693397 -78543100 10612553 962772645 160651394 238154919 -68310170 -576591947 442349055 -424182149 -84839906 -269071876 301741981 -922176890 -754581095 -264078134 -904952254 -906147685 -109058512 -311394666 393876725 -…
Output: 832754426 832754426 833418303 833418303 833418303 833418303 833418303 833418303 858923932 858923932 858923932 858923932 858923932 858923932 893454522 893454522 893454522 893454522 893454522 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 976811053 962772645 962772645 962772645 962772645 962772645 962772645 962772645 962772645 962772645 962772645 962772645 962772645 962772645 962772645 622334731 641100075 641100075 641100075 814735676 814735676 814735676 814735676 814735676 814735676 814735676 814735676 814735676 814735676 814735676 814735676 814735676 814735676 954118043 954118043 954118043 954118043 …

Constraints:

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

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