CT58769

Quill's Peak per Window Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Morning light hits the mushroom groves of Fungaldeep as Quill unrolls the day's manifest of marks. The tally will decide the next shipment. 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: 2213 1911 -95007504 465450922 380081647 -722602707 386382942 -401457724 939778857 492514113 -665224005 -651092884 -561910342 901752915 20511655 -558037787 369208371 -471196542 360900042 -54569713 45259712 632959430 704407725 -669709825 523434932 -375903893 597070620 680559894 -757990313 222836818 -997732938 -609124762 -523458330 -858188161 277380835 771016783 306103323 726008261 -824578358 -965720493 -462380876 -361044856 574423929 195651902 -201614291 908338065 -415830216 -82633081 -341576576 -296134286 -877120563 345251806 300086437 -940435378 -413615905 -762508629 -598523334 680113736 156524235 -319063559 493031621 -692114686 -168572170 -508947468 245753231 360990263 -705101953 -531863343 873018279 -118612374 -66262915 -978341449 975350194 -990935192 457554634 -755745159 -427533273 4896…
Output: 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 998876079 …

Example 2:

Input: 951 895 -94625896 -550448992 416954276 -532975881 911148121 -927678315 -717885390 -887482727 -448757497 690912014 -21373729 -605596870 820596814 673617672 -640027286 -282944682 777653903 -786159271 -237319337 206374696 961861635 -672930094 -646601118 156346570 -343866799 -968427609 146036905 437769499 -648682143 428545073 305653309 118590469 768632491 941520526 297956763 -197492868 -795191747 -539864153 -584105343 146963923 171456460 -816583528 -312531468 -485145622 -235995850 541024768 -491112635 -117746140 -95743730 863384386 873430482 198266169 -812701231 -542589944 -175445860 -611854651 979436615 36303025 -778871024 -641110960 620485339 401069226 495940975 -960375830 -91464860 612485387 113640363 -302794008 -25105239 -918563414 717987645 489786136 -291252930 610137970 541344844 4523655…
Output: 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342 994311342

Example 3:

Input: 11 3 207911321 54568189 455264944 -606251994 652546843 -767201509 149336987 641527824 859066952 258897326 -828988950
Output: 455264944 455264944 652546843 652546843 652546843 641527824 859066952 859066952 859066952

Constraints:

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

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