CT40429

The Highreach Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the mountain city of Highreach pays by the answer, and Lila intends to earn it. First: the full register of marks. 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: 1596 482 446153441 42436561 271902339 956123381 458951857 834652018 -55250412 -975696110 801302132 958079162 -643314756 -916044751 459665907 -531460032 -328574706 -38402511 -491075343 297962704 -821170157 -88724406 -68513579 800100586 181936712 680580509 103535749 -544944678 437170525 -302351067 -49709161 373057697 962844055 -375409214 803014559 11090937 238107032 345037406 399341902 -327020091 -232453519 351068887 838612880 503366539 826041046 546848880 -773082074 -371656601 -474686307 -796031138 -538657747 735105048 -107265118 -761708999 -222411387 60798889 791267661 -883150404 812054062 -651326276 637004586 -111096101 -578912676 196525393 -462924899 -992234622 -627915294 -350397113 -798413272 -664232914 72173741 99788138 -350576597 -441465559 -604596524 692711948 116869565 -891988927 86…
Output: 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 993154577 …

Example 2:

Input: 1357 493 918768547 -585642983 482539889 840509669 953993060 -682301882 466403038 788649425 -634260271 -550172076 -229458761 897470309 -244592818 -745219544 521234855 654695973 -873572912 -302619483 -523655290 361044091 420294645 -542468856 -491195498 -797130339 78909917 74964468 -908334813 -671228492 400598323 -653360229 -925096523 924329028 894748368 777595196 841019701 689534617 -438361704 999425439 -224065849 -987098407 -703296799 650129350 -585471169 -919445094 -612599610 815197733 232874313 -778336616 -603278653 123104936 -205405648 460753561 -589889746 293871733 804044706 230370385 330965451 -836221046 -972967296 172360804 -941493876 206987598 -431015265 -349053725 819923400 484389427 709003251 443830996 -833391011 -692709220 -113918695 48541472 316759140 876475915 -98191112 -1270892…
Output: 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 999425439 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 998947714 …

Example 3:

Input: 275 62 -477573905 -378702980 351416063 858458151 261123715 297416510 -475909014 269945616 368024148 -184415280 299000222 820893171 -902050154 -704219500 -61715206 188450669 827426719 855245611 436668543 218001885 700134926 -626999976 -790618127 848680604 -910326611 -149039594 805856579 -710691847 747545379 -752279852 -952406334 -401151529 -251549139 -237014202 -446664576 272251455 -543245268 -313491023 -887120790 360619167 -946353502 717568536 747492399 512899749 -457651443 -569491523 -2114356 -724342544 -252160177 521369592 76127695 -672648496 785635860 589721556 663085119 667617787 -842009262 494585059 -727645385 11071787 67998764 -732188556 732021026 375948954 -63768960 828090966 541790886 474448023 941899049 -657937326 -112185743 831340720 -89691296 777741296 -537134748 -188557205 -960…
Output: 858458151 858458151 858458151 858458151 855245611 855245611 855245611 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 941899049 929319467 929319467 929319467 929319467 929319467 929319467 929319467 929319467 929319467 929319467 929319467 …

Constraints:

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

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