CT58027

The Lunar Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Deep in the kelp forests of Tangledeep, Petr 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: 394 31 -128898639 838329512 -860884430 -409921439 -972694852 537010419 754144560 770391008 -105240113 -913078758 595272511 484149511 -750183107 800625871 583218004 19370708 -457993185 -372940714 180485938 173292853 -445621894 -813396951 613692474 -564783835 -73700754 554493395 198427177 210569556 304386703 -266560641 -237266449 -935737688 162252262 899486820 -284397788 409152849 624738642 -2058904 205460358 935672081 -214337292 914010284 418896927 150256329 778336383 -29695999 -33254837 633734911 -675709181 -697246289 -503570863 59973722 430459037 814563544 946950833 -637631862 113656492 -992436679 -187725614 823035758 963822004 -808556725 -43151369 19998137 -633239664 972897351 673765323 -478199003 388641437 482804140 -926014877 -929880723 615032953 446416494 849098023 -9927765 -411901800…
Output: 838329512 838329512 800625871 899486820 899486820 899486820 899486820 899486820 899486820 935672081 935672081 935672081 935672081 935672081 935672081 935672081 935672081 935672081 935672081 935672081 935672081 935672081 935672081 935672081 946950833 946950833 946950833 946950833 946950833 946950833 963822004 963822004 963822004 963822004 963822004 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 972897351 912825503 912825503 912825503 912825503 912825503 912825503 912825503 912825503 912825503 912825503 912825503 912825503 912825503 912825503 …

Example 2:

Input: 335 50 -105895339 475527980 -485716559 -432339086 215151366 882632138 130085157 -735836127 -962487347 292678610 -583610875 329807737 613318807 -289261125 -889263341 538132049 -101814604 -86191032 943007422 -797999729 -803901398 771973241 -934667401 -464392392 -331382070 -22521981 -534631005 103607036 462511799 239247743 -638535686 -794693888 95122012 -175935727 -21395046 -169815421 443194695 -851026668 -45336633 -140614044 479889367 406630282 -134332181 -470278369 -428435305 -949615726 -818796369 -594845040 -337725606 677868685 -545129341 691745738 -268696698 -853784697 329765753 -245155006 -806637786 164260216 -613845542 -605368807 -880763968 69632966 836515622 467817466 -475010393 879458584 -541326979 -856355924 373237507 831174661 -721189240 -682947937 -868835285 248194866 840576313 -99…
Output: 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 943007422 879458584 879458584 879458584 879458584 879458584 879458584 879458584 879458584 879458584 899913122 899913122 899913122 899913122 899913122 899913122 899913122 899913122 899913122 899913122 899913122 899913122 899913122 899913122 899913122 899913122 921393111 921393111 921393111 921393111 921393111 921393111 921393111 921393111 921393111 921393111 921393111 921393111 921393111 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 974309804 …

Example 3:

Input: 3700 3062 -888143895 908716435 734245443 116626383 552180763 780296106 -699092799 151922810 -417152719 667849320 -173560144 -533554105 -350159022 403392340 687588380 990930236 -785506394 -853388979 -353087290 546719201 -267129453 -261204363 428524309 -317808928 -125852516 -944135695 397935920 626129653 652418542 968701488 471870753 592611743 676858933 -205534596 -574059991 24272483 765257961 610889591 436221996 -509940131 667206484 -566636706 737353369 524335655 969032797 311802102 -380739004 -10610595 -553444104 -307714824 -686699699 -348859057 -533319203 -632148032 565970426 -946700794 794273618 200365065 -693873774 -380795897 -683808822 921028405 659642513 -749968552 -320985264 247556328 253364984 -362807126 -670267914 48548161 -906577747 -959849854 831114384 -665010450 -626791115 -1277…
Output: 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 999991377 …

Constraints:

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

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