CT62232

The Violet Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Farmer found an old ledger of registers in the tannery attic at the basalt cliffs of Obsidian Shore. The margin notes pose a precise question. 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: 3577 2019 -245479867 -926858444 533562533 621493232 354359786 503315436 -905633813 835040620 818507406 -375709966 443137375 233794072 -301077620 198501592 890840136 408861479 593525305 -197768777 285143 -848164218 382418732 -745155155 -851687048 -285062135 -389391740 -416952696 -787035146 954554051 876621715 -394391512 325415417 302609855 793266471 642590996 739938505 107428573 -952443963 546457202 310215139 -381989349 274145982 -48808720 -118725379 -673530609 -38396987 -832099269 768873616 -394261032 -302549889 664757208 -351797109 833673583 -890623974 221610206 -474957971 547847184 297273877 903615800 -318142246 -299994932 723539434 -388568607 -21283387 -956629312 592217210 -28747367 -770982454 -222279887 337935229 381186579 -174150843 94442649 -674179303 -717491239 -331515534 -867036179…
Output: 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 999918015 …

Example 2:

Input: 2753 441 -304781388 800828530 -551461692 -805823726 -178239160 -960963916 64329854 355666810 -709253815 679671349 645232599 -170735768 483726878 530521197 489004447 433213819 -270724310 225689840 580177834 -607136815 137094552 862376192 -865597534 242120473 -26282733 -861177711 -67186293 -375595503 501393342 -745885856 -340517191 939025058 367381143 278375179 820751658 576393451 -534492205 793377370 618724676 -183682503 -784985778 354267741 -444997561 756549265 612838769 529292089 3516734 152590199 -947408153 -828291976 253554453 771822381 967378781 -510438180 588230615 529161466 189643438 -874417515 -539350476 222142814 832400829 -796103502 868795092 900328323 -200819274 426716805 919210816 492962310 456812253 872024418 313326659 765162442 -170421748 238503209 534795299 182431677 87485361…
Output: 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 992677223 …

Example 3:

Input: 186 81 627111832 624387763 -921869781 -912513375 -471495171 166121817 309352259 849034178 -137671701 -780918671 -363760825 -467554076 -74885280 -621631501 670000181 256492447 -71127707 -882204191 765018647 659957137 -974344600 -463987871 261166064 253688351 -825748429 992681675 722746834 -504769622 -195672002 301453604 397679113 185729459 -668787333 -39559051 -690757951 492636115 -633907671 -539764222 227303010 353733456 993438674 -605563244 -150610573 -400740552 -516291692 612510712 547491063 -948561457 -837673977 669650588 410434856 -879859279 -266480129 654197288 -800206584 841093543 741952778 -805434295 -654558194 -275486071 -764787342 -720225199 583323975 562607407 428137301 -909061512 -954005801 -307696396 -883992786 -960547743 606759855 -703054902 293083482 740584538 971694889 -2522…
Output: 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 993438674 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 971694889 944744373 944744373 944744373 944744373 944744373 …

Constraints:

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

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