CT61568

The Ashen Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Lakshya runs the stall at the granite steps of Stonehallow. Today the books show a list of registers, and the numbers must be worked out before sundown. 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: 530 318 875474513 -500944634 970566729 800144714 -281065709 862395451 -228779068 465425715 639832653 771763421 -851055435 395237306 -603677302 -11956572 -273694012 -510766443 54712453 668360272 469305024 933399177 -440635066 398138283 984351002 -472107293 318643716 -50241356 -209635711 -861672520 915899428 350809764 -978041262 -265545682 226586473 -251446403 -923666618 90028697 -288143373 -567659608 652746961 528888496 -227397021 -766324904 -83898577 510837761 -715625313 388435180 -849438834 -802944050 818005557 514555607 -515447931 -1586690 -987602803 381786754 499955328 -636099774 544740718 664953756 -476362146 972533299 764488825 91314799 -395454904 -859886481 12120139 -256375072 -574258610 838568233 -425154877 -55273138 -5192908 -16547179 183589668 544966020 740728984 872499577 3699161…
Output: 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 992113282 …

Example 2:

Input: 481 125 448776224 -438804145 -802268832 734419855 -475118628 -864635956 260789912 -203862117 -272686275 654183526 180185310 302711383 -503347298 -542684798 -808862757 197878773 -467715227 427014121 -511310984 507706838 -644894687 895764919 -38552939 739696244 66364666 457119406 -645496767 815737150 177081443 -323877472 -754493212 101613322 -877316061 312026983 269629585 831536158 220981991 815020285 947524514 28806399 196168067 940858330 675275282 92669519 964958256 -572469152 262680895 730335614 -847024864 -931161146 -505948695 949720706 441253756 -294529 -39532099 -349346701 354620454 -729431835 276632295 -353918403 560559367 -314752789 -922795541 -620399209 -861647998 -696560377 960771529 288855742 -548207659 173326608 -783890888 553205757 -312590260 665863752 99628179 -870269107 -16313…
Output: 973470073 973470073 973470073 973470073 973470073 973470073 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 996922014 …

Example 3:

Input: 607 288 578002927 200172377 -376035351 -491472289 851202516 -397624639 521365495 -639326122 -730655005 942333924 -973040033 773093591 -277701306 -410525472 88316053 409274615 -44659235 -897737572 941905890 888028561 -569915268 -572538361 -162493098 556978911 -903306922 835257718 -237879760 673405209 398758751 -488424828 519632849 -490078373 295861030 805165144 901950800 -431124275 323383034 423227788 -239225271 175183155 106499221 882962321 -879785567 -95677873 -943183670 401527298 29947447 -268751814 597533158 -780246432 815207995 -293733639 805951452 118672122 -790657543 -404671460 -410146272 -743434018 -223998151 191375929 782633756 -527362824 -305883758 -301272157 -602267438 671464430 -448592486 -990436761 -293519399 -857099795 28968831 -488709215 619697498 953406078 883394105 79228511…
Output: 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 994717230 …

Constraints:

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

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