CT43665

The Whitesnow Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the tundra station of Whitesnow, Harper studies rows of ledgers 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: 889 248 -977601051 282400826 -261303311 438203380 557396240 243548910 424338290 933111986 85194292 394868786 756848290 219345940 -966448448 -886998064 471157955 -393317724 -188084196 -277775808 -297700498 854174227 -13741789 214614594 -560252478 683955268 -290975805 -530076639 581757592 -423482458 -195885438 905442109 -256734010 27839653 402906173 -668323202 987337707 813533896 -325146162 -900114139 380074980 572709516 -71907390 -971557787 870588364 -337076874 930910310 -882117415 -540485648 -660592127 -264866375 -914774307 955969963 -622390352 -928529666 247216549 -524901802 -893160032 -745871433 234331033 -251327155 32659536 756704667 -89471028 -848616826 -689201979 998580722 -39035232 -51969212 350867401 795378755 -958944561 -274597534 -930418387 277950570 -155209823 -541965610 -3773341…
Output: 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 999601836 …

Example 2:

Input: 735 136 74780083 926408700 -212730122 503085607 -15715342 116640668 460647237 -248916237 -40172977 -406430439 -263928420 200753384 -693912226 211115597 -703169261 -602588238 -983648965 -573105455 -902228624 181666385 33498004 367584430 -361666454 -629467228 658694497 -162277860 680795698 311313640 -964164094 622105951 592654660 381667844 299345967 180800086 545542092 -993179051 -736080639 117230408 -141678989 221254807 272738907 -427326236 -648064458 -667186174 273146765 794461982 -716378506 113059134 661992789 289309207 -985816654 -320113927 840271050 494014480 -477609828 458889183 716464357 557628470 -41014996 517141549 -634417113 538963087 -525001059 721583601 330861312 949428175 16165240 621348039 350882538 631347590 338418142 -369377455 -114187346 908198445 900971798 -665121130 209930…
Output: 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 997416756 …

Example 3:

Input: 2238 1939 371802234 720803906 517648456 -598472555 171633701 -612544326 757292708 -29823630 -896042533 -933633597 317167000 912577051 869852463 -735460140 -827862741 -141008120 -162230083 231420443 954509547 -297363667 -45350094 179087277 -654131594 829895506 504365146 112384909 794850174 -575938744 -99776097 -204862820 828755174 117058782 319620433 -205341921 -827222494 -763610402 -608414314 741135703 -534197734 -185760552 936570854 -795910511 -377543479 62089832 959095262 -796257925 -89661071 426545995 -325082011 586439169 553146864 -716351440 407636555 482971338 872626630 112175123 194380510 445679042 -668570838 -395573221 348621860 -136254697 367570526 -448499805 -206624087 909350777 -510486424 -990763728 592818744 -242997175 -808677184 -359211785 -26073211 -843278705 430171810 8347156…
Output: 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 999071875 …

Constraints:

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

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