CT44396

The Peak per Window Beneath Emberfall

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the port of Emberfall close for winter, Koda must finish the marks 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: 1727 1396 723006582 -580102138 108705333 103430682 693201868 -972346967 826599357 -435498120 -984486597 -18465950 -485977208 113184166 46484349 -612618373 924135874 193961830 -431679308 252218491 467687006 -14824030 119551443 -397974849 -671069082 760936123 -53581560 -538215266 -448568014 -870948763 -38575458 954520855 -906887681 903388625 -880854749 -552989854 513986119 -737079974 806198544 523372145 222622343 664376796 -359916340 441775480 228298330 231320454 -36714591 -914086171 -538798550 995514921 120618586 -733414241 -864206831 -611332392 223938884 257477988 13893908 -817772963 426721093 -232184755 641094615 -904927398 -31634741 549626230 718585423 -796675316 -357115610 -386249751 -438589255 581617210 986028618 -738220537 -681288761 752623893 -465236457 -308837600 -525810520 -4566401…
Output: 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 999590614 …

Example 2:

Input: 187 130 418537054 -443919132 -185369667 699519968 -663001557 -175343353 316145862 268490616 67902523 958468369 704807421 -153890290 -954101439 286051181 682066446 533156373 644552376 240778399 746317988 -969766723 -183608568 -245097408 -872534337 456487911 151520631 976480744 533042098 407689263 -734810489 10014368 532997960 899558778 -107214759 512787387 725796821 10628968 -749622037 -185897458 -261745262 777178399 186518938 -973245228 -762703353 -943635107 -267433713 -419366217 66779480 -966365056 -788228984 786127859 -676075052 550812194 -90908876 -76021122 -86893502 399438962 306745571 179288811 534393332 -474021346 -406027190 336861823 -98382548 -571744368 690057217 -253288806 -658060246 -453446901 662181222 396534720 -821341252 372075554 688201047 -556787158 485390518 -679126253 -518…
Output: 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 985358948 991746419 991746419 991746419 991746419 991746419 991746419 991746419 991746419 991746419 991746419 991746419 991746419 991746419 991746419

Example 3:

Input: 2359 1864 592458263 829532916 -456774495 -421717318 79229005 39392057 -576100671 -668248822 -844645477 952131328 -354101826 521928582 663002535 -715988880 -206616157 -837120229 -92213068 549788297 -145522843 -236610267 647213972 276952980 -367192222 560508016 -419473314 -644168954 -474770248 339090210 -711838999 41810431 -770656984 772352377 -783388266 645545760 673667311 113999013 961066604 10108874 -822562741 -478860082 -110048525 579335746 73604076 568778260 -650772880 -272000618 667767213 997466133 574699821 463822878 331849200 -948592163 -689746113 -635404324 -968789680 890096511 -527866496 168896624 72997321 -416296442 -934112686 877245228 -233640156 383533487 839340818 -673527986 -711579412 13504277 -902837221 675392927 170778631 -213482200 171526540 281194265 -786059889 -755049184 …
Output: 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 999128037 …

Constraints:

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

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