CT59379

The Peak per Window at Will-o-Wisp

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Farmer found an old ledger of marks in the depot attic at the fen lights of Will-o-Wisp. The margin notes pose a precise question. 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: 1430 174 845952847 -318781023 -343578955 -235822633 827019900 32919060 -944642528 700360922 -241094639 -86550181 553060755 729484051 -624126156 627001182 516456212 143679449 376887890 -508387163 257359364 239865921 400248040 -44637018 -255525061 364879854 611602323 715149693 -923611816 656696361 690463057 445023542 -773194917 -183597690 -391152779 -879154154 530318373 -283818765 928694501 66320342 -985607554 -846473664 -702499485 984188203 394984620 416988668 -982364978 914377368 849195796 -973891387 -372097728 -32721400 -795405394 -330314507 -394419381 808591006 -311099180 602493930 244997820 343392588 -180900106 -187941709 104125806 869564355 -876823617 -801782649 619154109 528444275 -595505671 -701420728 -459244888 -991217389 349297390 -340641914 275710155 890951355 -774815788 -85879336…
Output: 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 993277850 …

Example 2:

Input: 441 268 -737017968 -55122296 -161320689 -566447589 -520555569 -196559098 227238661 256197684 -846795668 -646031219 582460419 -748058888 -948817798 202679881 47089671 -796889287 -780243615 565578400 -956004718 -174989123 -817107458 -611620120 -473417946 -592705656 -10755406 -602557997 -171934000 -349881207 -947214250 -378591460 -699674770 -635248499 37975487 -793233319 -183347782 -773974010 -63899908 188518831 -784318414 -990359272 879456706 502696966 -419506315 -703732725 475268893 873167832 -43029668 -59665505 546054347 -56602988 896369022 -56070272 -906487387 -254394845 -998448818 -114979567 -902902993 -130863291 872788341 784457025 617830540 82981233 46448738 -898312402 563284025 839975896 687709247 939354545 -243172265 534792173 -309799328 763121159 839193671 -810480712 -654086998 1264…
Output: 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 996386199 …

Example 3:

Input: 1119 90 904285673 -577107728 617559286 -677820566 -223059769 -315571376 -946856337 -182152829 3907177 -11756618 -628965525 470336474 -674788912 754588647 559361372 847544984 34143981 -520783461 291708259 448493061 -137168759 -894527895 -21004426 905901787 -556486207 942486348 376642497 781251601 390198037 374094561 623817944 872176758 -165988183 -50944380 68345652 104057212 328821772 550077531 -505266999 -500698585 820458865 -698034455 374069347 -242601583 -653813743 484764754 938137288 423073981 -424343484 -366268340 752660384 -788898359 89007558 -343429370 -220043252 154279421 151870400 -78894419 140569224 332678014 -577550493 852083979 343859341 -567633379 404167577 -544580253 513751767 -777169893 470094274 -511742417 -370300260 332923042 769551460 898368144 821187288 -547285810 -974069…
Output: 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 942486348 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 971138048 …

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 Will-o-Wisp - MEDIUM Coding Problem | CodeTikki