CT44380

Diya Counts the registers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the crystal caves of Luminar close for winter, Diya must finish the registers ledger - one figure at a time. 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: 3588 476 -495787833 530600305 359417530 -464371985 873942711 -965339254 -202223883 643678320 520456636 839005203 559886946 784659365 593737587 -417001503 -526849717 -321561971 445669281 220025491 -866737522 441285532 382453174 887748825 -131940270 -986908547 907874446 -315159883 838879856 -377344383 -227707833 227914937 -768064032 -941458 -471818928 129268622 -756524561 -706868218 -877189304 211264698 -855893725 634009365 898399501 -802484842 737508795 93244834 -757393873 -192395745 -356561880 -49608990 -29286918 610439530 -804491972 -744827058 118554056 475098682 772236926 200996822 -491910979 113031448 201067419 -272486041 758379008 -117109625 -955115398 -373484532 120547113 -120049289 199843957 -317857287 141746041 -286929756 20234054 -908347008 -99094876 250327786 302577500 255220492 -…
Output: 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 995422006 …

Example 2:

Input: 306 91 356761917 975994646 565755481 445538796 97677454 -575976788 -781211798 -839309394 -27216513 17670850 -885964075 -953529740 651313338 75298752 640802677 -400991262 -975196963 -864195457 -735357246 569897591 930214363 237218713 480763568 638608165 -454401728 957514144 -296681680 561973869 -559065316 993411812 90216276 -646019800 -768587205 9318233 -730271579 -938915247 -960266892 -797996604 656493499 -733449440 40432739 -11591036 -145732588 -227036424 829770102 364163917 -366764181 -169327243 699995915 -823032971 -981757963 283179537 -23538687 -441694346 896461303 -627402612 -647940474 -596141675 -954285901 -453921959 552360628 408342214 147569667 -617167332 -614997795 -701226319 367561543 128407561 -347870429 -35241234 -905652824 354522491 184221824 683719428 718495619 -943328976 -60…
Output: 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 993411812 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 989132480 985711245 985711245 …

Example 3:

Input: 1909 398 -918424306 -826490070 337610571 -583623585 -297334555 811040481 -927382280 802052435 -44856827 425736568 -453223518 589845874 -890431500 740053064 786215935 -509991535 -4285526 -535210600 -571493724 870625096 -121617610 64967210 506863840 319326186 -562627351 -766630923 938522029 561110883 346344635 919479463 983403199 -954205630 -720547942 -309540023 -9599973 473772435 22548126 67751769 646673091 -484967332 413238632 -817536934 -723299845 -67096558 -338800781 -749565769 871889332 680969637 767428070 156007625 -939801335 -481948807 -652388588 68205225 -503970411 998151222 15558778 914437358 -746801668 181611960 -350785087 -483575619 140845833 -27772253 -952451198 -990599736 -305962565 -369365398 -39170554 806054084 705821971 -256751862 -121093126 -243584197 285285477 457290009 182…
Output: 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 998151222 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 990530414 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Diya Counts the registers - MEDIUM Coding Problem | CodeTikki