CT59170

The Peak per Window at Firefly Mere

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The harbor bell rings at the lantern lake of Firefly Mere; Mira weighs the day's registers manifests and starts the calculations. 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: 2497 767 708174868 505115661 288533614 546928721 -836511367 -865972685 -580717855 790658160 -864144854 -284818877 632802587 -201910882 133182027 57168532 -641482739 -809178110 -808354794 -791073434 620618121 715009172 690293980 -949608560 -697261254 -972894939 -591192947 -58392593 -399529765 682533311 -889056920 944910756 443744899 -312112349 722668747 -265310570 219143870 898297764 -478265788 -563197395 -825497843 696340923 -340999987 -792110031 -369921009 973339638 -53204840 959892055 -198359267 -197284101 -601875786 -887659784 221497941 -472138801 833816327 404062830 943144523 -267132130 -763927346 347164760 -363784381 -427636510 757496490 -980324854 223782374 -192588874 185841215 -819792306 -427923303 798630375 150701997 -770121434 793385064 -147867783 -788834541 -4873979 -815181914 96…
Output: 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 998411424 …

Example 2:

Input: 2355 2090 695247867 -944967780 750107710 -977039738 -779839930 771538578 935603849 -862264927 -385117538 435092048 -440833833 -880250706 -231581748 -421751535 32442295 643793145 -246612444 -68495983 -52171529 59182106 -857986864 -104133544 -660317915 645408130 -149626394 -301325165 100091771 572427581 -44675102 -973003518 810011356 967645883 -648621135 73681796 -245771669 882936613 252782578 -867064346 -235549621 -359006275 183955701 -668233602 198125981 -380226030 65583816 583964483 978594859 492180124 424074265 947595762 -61796144 -44058176 433274430 -296052071 630026067 649536064 7176763 381242139 -448680913 451597148 -41561938 956473974 125991510 414788789 -479968058 897095161 239739064 -323844546 846805026 50243127 764527013 -808618203 -380101977 -504522928 -302331010 293806413 404150…
Output: 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 999305559 …

Example 3:

Input: 1233 41 868214633 -877199898 688513883 -247757692 -733556525 -70077835 -880010954 -569021556 440027667 593085574 -754963007 614439752 -379217649 -239132703 -454385724 -187806456 -795877130 214195143 -756020905 927628526 -138711457 166192347 -521085209 507604037 -917776660 -173578018 -608346861 -45962035 -756114498 -117008978 -573584219 -804296543 -968620427 -51750749 -695050685 -735246532 346682462 493668387 522092669 7729359 -200058278 -199455852 -430693667 -385550417 -198563897 255628240 632872252 -732944109 -894860956 816306904 -379562120 -540846233 217033539 -955232224 -739856580 -643201963 600852961 -342877200 253589209 -244862591 -117024397 240312405 -341399122 -493432634 -297357147 132624719 -798730244 -251917806 211110291 309590051 19992109 323407764 926503017 -543773301 16805081 6…
Output: 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 927628526 816306904 816306904 816306904 816306904 816306904 816306904 816306904 816306904 816306904 816306904 816306904 816306904 926503017 926503017 926503017 926503017 926503017 926503017 962502033 962502033 962502033 962502033 962502033 962502033 962502033 962502033 962502033 962502033 962502033 962502033 962502033 962502033 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 964242323 …

Constraints:

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

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