CT61750

The signals at Highreach

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Every season at the mountain city of Highreach, someone must restore an old family record. This year the task falls to Nora, armed only with the signals register. 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: 3273 2734 455068721 23024545 691924693 789809350 678298860 565562573 338777385 887956045 873912227 -854286061 370624319 -875143815 381927106 -159455675 559675337 212050006 -892901385 45497536 242709889 36567461 526744662 -610303787 642139434 850136902 868572066 754086098 -288875496 -290653665 125984802 -678334004 -445653977 953259085 471984331 -32701441 -111056172 896100447 70426058 662433958 854599954 578084999 201403972 -121772229 -754748049 -686136283 667624960 -927759492 -708094240 -226914089 -539010747 165247256 -832932312 -290716246 -805973332 548337737 -180546067 992322586 537108156 -525151580 721685092 143930989 -63135704 909974079 -379582886 -307185782 -747498767 -847134198 -343101341 -411330208 617645281 998921401 -271235368 146467946 286569689 -403616798 293447034 -407323173 276…
Output: 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998921401 998362370 998362370 998362370 998362370 998362370 998362370 998362370 998362370 998362370 998362370 …

Example 2:

Input: 300 294 -736349980 208978088 37179083 968712735 69844187 -312296039 -460068596 -932447313 -598641104 -979831660 -626916685 186809842 830338621 -586798658 -555572285 -99366143 688113094 -487860809 -5724100 -289701167 -580084280 -533526253 -952194010 -904798123 457866350 863938935 -518049820 10330286 -465101543 171253770 -826334000 218538091 -735094868 32884545 -281317572 -195867337 582554533 126859259 -216791482 -454882910 538603174 49309634 585431213 290214143 -204746317 101797480 -814088208 -531524580 -557447797 -51066540 763851769 419153987 698779782 -586056767 324403416 349415488 132434619 299719354 -392743049 -410885424 -427039150 703723029 -62561823 900396172 980666057 -444618368 382419360 -74675671 -514664057 -475444583 267822681 -36995819 -891648350 43797718 -418054946 -652251549 -7…
Output: 999222111 999222111 999222111 999222111 999222111 999222111 999222111

Example 3:

Input: 1939 517 83534468 -184376521 -725589647 29503126 -556299344 535301437 -511516040 -987312789 88752690 -555775455 -783125505 -229887849 -996388865 -397163073 -653065168 -316541777 -452151468 -619896065 843470848 58998772 61601004 -793417710 -62196325 181624167 706986636 -465057403 662649334 -947430654 648197408 230307732 932572185 -793909063 12069394 -631683905 -13333864 51875709 722719923 116097954 -209191396 -120899868 -59531033 -907382492 -331286956 255665843 357742596 514218855 994818684 343957169 -848339090 -161311905 116885278 -942022712 7256167 810502860 705709645 -751293841 632699170 -176869417 -698533976 -971220171 -990587012 -89267385 765956896 -715411787 -778785607 231738580 -318104351 -723325625 953146917 609748165 -486680624 -939462079 -440614601 942699966 643831520 -841901552 3…
Output: 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 998166079 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The signals at Highreach - MEDIUM Coding Problem | CodeTikki