CT64009

Maya's Moonlit registers

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Maya the customs officer watches over the river town of Willowford's stores of registers. A careful computation stands between order and chaos. 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: 1700 1118 418394442 -496702443 5403902 123445156 -753659338 -337944817 478325455 435405035 565620866 162497903 452473152 971042457 -420786959 667573873 456001083 -801763571 34708179 552304900 -635298966 200022752 680209377 830795550 530190675 -98984495 -429150547 -123690249 -593882712 -172655463 -401784774 -655484827 962937359 -603057437 695997134 -43836143 553835343 -784883161 -560900288 213152396 -977260814 19924487 349047744 -81491737 -510562993 613075020 516885904 -670830170 403298383 104561606 -83619969 635986798 -518900505 340262318 824028317 -646982610 -258027253 -8876723 408440468 -579894126 705905080 -559886862 -523124421 -849566806 593643357 595455880 440752650 -50086399 -5991028 -713982038 899447079 -829946014 439844929 -342584306 986861104 702070356 -97532232 413223207 46160347…
Output: 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 999145745 …

Example 2:

Input: 1791 1377 -176975577 -897354880 926352466 971931760 -319335591 -511790955 -63266804 -992327511 324452574 -2495982 -834249705 425024254 734657887 316041552 103721928 -299433302 -384611063 -867995577 -270643466 -590604482 712207832 -780818594 729730837 658728863 -676999360 -484887961 741698431 -302315287 115542660 386950268 917531910 61843656 436002623 -709427916 443131940 -120007501 -288338068 823662971 308915996 930894681 -102657959 -478034941 636665832 -141040575 210459414 -720333940 955819927 -533300300 -241645335 -763307724 503783951 -67830524 -125275072 -136546160 311113921 -226939936 -77041489 -852370404 -870890999 -166137596 426737582 -766472852 -396170121 828162370 -628475364 -171104988 810830689 441378502 494857831 -929207501 -633352609 480740738 -887070334 680861600 -394788054 406…
Output: 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 999902077 …

Example 3:

Input: 1913 396 -102861749 263786785 757948655 -354374260 -394034656 -577800048 -13363799 -511663001 -303948787 -139911502 -541377928 -628202439 -571167538 623924838 -681769781 -80123091 -47614704 -603397081 -894644674 -927177239 150722253 235665756 932154754 417853680 790400371 121456323 -739700806 936121101 53726314 -790929214 -435609484 -380499852 592287288 268340167 123577640 708346474 322092604 -52502888 -526581191 592310447 801349063 -208099547 -334596671 550198849 -145822495 -155918103 -90801366 -292713857 988341175 -837958996 -908735062 342739865 310668398 -841863342 -727096126 -684121743 -735740489 234838163 -178049115 63243691 24448811 -87433520 -738735270 824473300 953646332 -954304708 -417055096 -84194687 57254616 266973980 768737585 -409008501 342343221 -209327277 52863329 -313335026…
Output: 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 998250325 …

Constraints:

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

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