CT51923

The Peak per Window at Blackglass

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the obsidian flows of Blackglass pays by the answer, and Dante intends to earn it. First: the full register of beacons. 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: 911 440 -334622989 -783578769 -126870413 -436495522 -569779026 666261123 -641722572 -790682395 -269417298 549631239 268806167 58289933 -605286440 197741340 -218060717 -487745361 324157727 521899102 -809110395 -514181453 -5349319 580098345 957792365 -148648036 -167865695 556250212 291365811 63330041 -727360982 817526113 -197886784 530237170 -92930477 -571369848 -526730254 928826810 -331794962 -813408414 819243298 -216791422 581738245 -860734727 950030520 -780037515 -802481475 -405121847 -197667423 28294813 -624777404 -727164303 209708413 -361845616 167787524 -29804491 690841595 -738867396 -564838917 891260373 -78637830 194961738 -423063500 -619699907 -523626657 758846050 487579222 56206552 786462010 -541516933 -674890288 -173447559 403055568 -392761862 -606014108 96080605 145477780 59687459…
Output: 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 998530425 …

Example 2:

Input: 2566 2558 577214807 -878243636 50320821 428790965 -257470405 -565351478 -445530403 843822910 -110374149 1125035 816447329 784562650 -551351417 841862943 -789021049 566868336 281863708 -921987650 1386784 146354309 801747496 518915943 52687169 999834601 -365167592 -243094934 -623826431 29348826 -609853215 657552485 590326263 -664814456 796363419 395278359 176344033 285743125 -237451048 -454588180 -684023061 -361504204 636370273 459087471 669990764 -933614237 407697984 -762898280 -409244036 351791946 -975943375 417883047 544745524 -379656482 904797871 575671417 -331675941 447829938 -465092526 745057413 -690701877 -422859273 -928168593 249181780 -728642777 -517100588 -70266015 883341709 -314758114 876657758 -232215008 494618243 241931782 -852894230 -490698079 978958786 -857124016 474064577 -42…
Output: 999994963 999994963 999994963 999994963 999994963 999994963 999994963 999994963 999994963

Example 3:

Input: 875 708 154655406 374978057 185363567 844940249 -476670602 529026304 360480221 -121194058 -850322900 -574507011 -450120433 -862154873 -340627295 -430486384 996393758 -685539136 -121543667 -155765881 -479712056 739635755 -1762427 517859151 -859325220 589980679 -550002748 -201404662 -21534358 912937148 91627583 972341288 -602955104 464488024 -744144883 306501418 -336657745 45287406 868396667 274721362 -510153063 -500040194 777252406 -174075047 -148935375 127115532 -792504924 -133012602 -461745816 -92083947 -391099756 968457039 -316356344 -427699217 -327221774 -138918811 349108687 -979646936 -745727468 -939329110 514924991 -283042080 68558796 -822323063 -416749041 480916193 195752793 665210637 -870345620 -145682859 -885974634 -916121023 -855870867 -51417987 441615903 398670526 -968890013 -337…
Output: 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 998195813 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Peak per Window at Blackglass - MEDIUM Coding Problem | CodeTikki