CT63514

Rowena's beacons Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The quartermaster Rowena has been asked to catalog the new acquisitions. On the desk lies a long table of beacons readings. 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: 918 119 -505360345 -270843715 12921045 -605103642 -381558776 -562949174 757120926 -962689867 -291309794 -503277433 233849391 -743979409 416379551 631341610 -571530088 243826492 -507564662 -929730505 -365642781 -20507655 -38778643 210679352 -906825813 501542037 -398975141 748588045 510586082 -568901130 671426160 84167168 492394814 -974567415 681862146 203105303 895601644 -240278459 -600320427 -379226764 -3206834 462529105 719065042 332078179 416436164 704393896 306160481 -998850690 -733126848 -253989870 -868590986 -746814824 -855495668 271432816 757616844 642618953 -334871124 -499544855 65962846 879189382 458871607 757456351 -440790437 -672319737 116089464 -835730847 13923189 554091439 -916266464 591395251 446818632 707994430 440252799 -179061786 -12446634 107412556 -653668365 -465193027 -5…
Output: 903204118 936103035 955159545 955159545 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 998047905 …

Example 2:

Input: 3503 1486 91298676 -596727796 171307339 557057403 226540080 444218821 -764598860 664301654 -599590071 860106442 425905557 322159992 -626014482 138736131 507759152 711982803 -577824578 -187732650 547712114 414711299 591094493 -19423543 -256370390 -361306716 -405563780 692753868 899877601 -217280757 738125222 -168181315 564710249 -267335936 165131180 727845533 848565346 -224373233 -676354889 -710162762 386276132 -493847147 666270328 877469874 357301743 673154926 -835974204 182208974 416527938 20836392 -303114635 789797391 -334010744 315076262 -565286033 -116642482 309786200 -867494013 -494466173 853690343 227852843 720196180 -492102953 414739846 569371643 185721115 78388916 -149138090 -760994584 527915113 -584092684 -886198839 -467670358 110899024 -740378804 -569602720 -62962372 -385511385 6…
Output: 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 996976805 …

Example 3:

Input: 3529 2780 478653718 828990010 475961003 -253389089 603308931 -350825590 -133076034 454900738 -329610937 371235650 156838059 -120008752 30839909 -145278584 505704164 625153624 -622349608 -220450169 923440057 -260507413 -228011294 -308658044 -130467463 -499076166 466672615 -339932342 429182620 -150597192 605607850 773053956 125833754 -517169911 601270455 516728436 -68680308 304556569 -386501714 -225662161 -956407149 383402775 923016534 -676007444 104521509 351961662 -146363864 996437869 -554667858 25447000 -84054037 -518973176 796811713 -64611054 495328550 -654590252 780557067 793747584 -342413717 250776067 -636918522 234963563 -783479382 9200081 136981828 -474344068 -209722901 -794743700 -421991217 -913994603 820877273 -742606569 -260336673 65599298 -726610356 -713290422 -162852297 62840223…
Output: 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 999566547 …

Constraints:

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

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