CT38419

The Misty Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the opal reefs of Shimmerdeep. Steward spreads the beacons records across the table and picks up a sharp pencil. 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: 2287 2158 -157032289 -326603630 -169419111 -414073690 460582688 599918841 342097257 532458665 -404725465 465180582 -693481013 225709591 893780895 -106636738 -318383181 938681503 141866424 -800700833 249768573 778491210 -611210666 364026726 782917946 -189516792 -476190330 -507969588 -82430417 744232686 -718558082 960198869 -645111303 -317864623 -727149629 222632884 717887246 741443262 473262361 90380478 130799489 949758717 -739989048 649215523 -81178095 -603499211 -290472330 -341601869 -341366615 858234705 119022168 807358168 211012135 598534306 -253197905 130800976 -133836117 -384027297 -952329055 -315081134 314030388 137371367 211006686 -616068793 116554171 -618107747 674948003 -553944415 293749799 709850132 -163687776 -901776357 -435444948 -548818740 984573880 -921287385 -802329169 39177…
Output: 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 999832382 …

Example 2:

Input: 2157 944 266670023 213732858 893648255 -495524164 -329532882 -465583109 -476628209 326184317 -761545971 563180029 367830138 -275560193 -748042955 -350151940 809043567 612077161 -885877783 422790830 -244409226 -296081333 21121356 371329696 -56943135 -155077289 -136142736 409576403 -142797591 -882927266 22611958 319818427 -990106538 -577603764 -970583404 -126286112 -885303772 -679770498 -814994584 521318076 215197410 301649555 528192046 41500262 318012152 -101956983 500952085 970378015 922833628 -366766905 109416035 -155386258 46036917 216185646 964678985 147233182 -73784945 247397123 43377630 999951946 982277034 -903267882 -755629007 -240786800 -427602197 765440334 110836988 583862107 381450577 240297082 225326732 -201655481 -660573204 446440845 662823970 -732738586 -280437325 -352118301 35…
Output: 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 999951946 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 990071713 …

Example 3:

Input: 3899 3392 36474597 -966392657 942131463 -3321963 -686567647 150181846 524381741 661056244 -964586640 536953759 -21433685 956637354 362741518 67780303 -382829955 499393421 307705847 -871958243 294913090 -987409568 -208476680 45470500 -263453746 783554210 46564900 -875659140 717335312 -659324932 268445962 -470094180 -254995417 415217563 384989429 -136204115 286224305 766388002 -804338144 122426585 -714275320 922420792 526004236 -72169815 88319401 -145114216 -147542939 -130248295 11339894 907694812 335781091 -423699168 524737494 453228406 894268633 -453267107 -599642827 -214442436 942460915 494259408 -619627436 -800463490 36425449 -897821354 795563803 234424418 -728279559 213796791 710524139 -733480554 147105319 -429463487 -28880504 -242416218 351790952 -275252158 -42497334 422370191 -4271517…
Output: 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 999825251 …

Constraints:

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

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