CT49736

Farhan's registers Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the ember dunes of Ashfall pays by the answer, and Farhan intends to earn it. First: the full register of registers. 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: 2806 2176 -747633631 391706012 -945335728 -902797024 -433538772 -823556719 -158628663 -113616196 -538612861 -450077790 -828800878 345260627 -35451754 906061333 688582973 -274430771 104587527 504395074 453679103 51272728 938600359 32152032 -207987232 -690333339 110638551 693481650 -256760495 218962026 25123849 -407114161 999865631 154415809 -746894550 598879642 -928386647 253370643 -614916706 5996642 353661819 816968265 651220547 -341534321 -277001467 909400078 -115300028 265604637 546433478 90460232 -319636249 994662460 93739103 773145859 136131615 681424466 594123910 179042692 171810310 331726957 -970782741 -263151471 -535826161 -885088676 275938364 998605960 -300972989 830682096 -681021332 352644977 573302568 280892764 784209686 -464386682 481902163 595633114 -596825888 716793116 -586722…
Output: 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 999865631 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998605960 998164762 998164762 998164762 998164762 998164762 998164762 998164762 998164762 998164762 998164762 998164762 998164762 998164762 998164762 998164762 998164762 …

Example 2:

Input: 1751 343 -840042056 -114520920 709832070 805753119 -362831787 506702628 984582961 321162994 -736151735 3827987 -68698988 326770554 -617095159 -208980565 834562288 645064820 -529226874 302828821 385636516 975771166 604103706 -244778823 -549054765 713796324 690443970 -594982962 -927525930 943212511 344068560 679784578 -563402976 -176456198 591601084 -760790484 -146514669 -939767269 -689735795 384921066 615581964 716009897 931872101 716552319 536069659 954722481 -31969491 -276899048 -608824047 14386802 -907441897 -748128350 136824920 -838537282 -374347559 -509312725 145662725 934425463 -835043239 132622690 -217827178 256493276 243204198 343028596 901910761 36733147 855510215 843337591 -756867932 -288985984 -964168187 38406317 -654859020 148209322 40003370 -584506185 965200868 624850245 -42481…
Output: 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 993785944 …

Example 3:

Input: 225 82 374134948 -822222234 -881558733 -216856949 193518716 292185860 783122597 274378762 -25474910 -371418330 602737149 36244268 911622256 -46886265 227988670 -916372710 114604474 336386581 -505647915 -805713767 979423120 168027764 -403463181 -503373580 744138623 -340170025 91272916 887843858 205950980 312767467 562899893 123075774 -65102696 -140412607 -13972267 -391253209 686376070 864019512 -694192445 -648621784 -579728822 -794996716 -845073262 438943224 673301054 930534528 567372468 636122673 559218328 660988490 -540290755 82964641 -864220256 -122245318 179095964 -481240398 880149973 265660955 -627162462 69660219 -95633808 716073445 111375783 -600065422 715430680 -456792920 -234456169 903219071 975463397 382425233 -650359930 568139698 -139097428 198054417 991178310 866295307 -208086279…
Output: 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 991178310 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 999382762 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Farhan's registers Peak per Window - MEDIUM Coding Problem | CodeTikki