CT57381

The signals Peak per Window Puzzle

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Isha the measurer watches over the shale slopes of Greystone's stores of signals. A careful computation stands between order and chaos. 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: 2592 1849 586614854 303143867 929439433 -670376836 -931687136 61961979 -602671131 -804789785 -463901836 -874954070 844416598 -963143372 930499445 980722538 117331437 -490302159 -785839681 -392067776 273377982 -384207333 -935058880 433155276 54482555 482994934 -125715502 187099778 401847369 -411076031 -487705610 -109458621 110702826 -632332263 106838020 -998843712 -805401714 212412223 -317405414 -66255822 -953807981 -43517678 190309445 -436156692 289339371 -520096757 538790336 586916314 352866097 291728099 -917983616 -421666651 715207370 681634056 -179340295 -202329851 -346839060 240207966 -709073389 828922149 670230805 749695028 121116794 -777700233 294362518 54283134 348894396 -387482925 -731000282 912756167 231998402 -998282209 828157294 -708139494 881669623 462427212 996930925 351580351…
Output: 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 999992478 …

Example 2:

Input: 389 221 -638920235 574307071 860804778 965717945 -852344822 -599995458 -426255083 444068114 -387957258 -719040473 -360774626 -547049532 930090161 258087244 123248499 612454125 558042701 257336932 -495863670 375712952 -164399898 -844903126 307678745 2230125 630971518 -804465769 -440626635 886590509 491724116 657895230 -402652120 -987123403 861861642 -865725049 -646423191 -502876492 -515214756 -134686893 -642645303 854405535 61812392 901001978 -355196042 633840201 -460162683 -298782668 -837141415 -62051879 563037015 147699423 45147605 860263825 516928954 751894911 -983019713 810364127 961143569 84241303 -518634251 -60302178 4364864 -316766141 595157688 -377342723 -820993775 -105010641 445813886 286760621 334718777 -534140639 793733244 445683831 586330865 -486696286 13726994 507364292 -437744…
Output: 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 975164028 …

Example 3:

Input: 2610 1388 -273869563 -920711170 -678137064 -943741575 -257250560 -59398801 -231830712 -739155414 825548508 112929137 441942793 -294769851 528104753 -582836145 651487918 331118927 528445417 374755567 -245044775 -802197123 -437440345 -950560043 -165774455 -418058276 925791551 946737886 -367947563 839068779 982244222 394362962 -329929545 673701054 -633301800 243847551 95620428 -544369057 33934010 317391745 415060629 492437992 815347742 981445793 896684484 -98554378 462882877 -439987365 385637948 17145735 -285250787 -285784320 -934426963 622103703 50236416 -744503755 313829163 -817599659 -366511338 527838170 -881990125 430317825 799125629 -282831125 150259321 -655051347 336152100 -753967352 -630029686 278818171 -363691126 45932662 -735622226 -405676822 226911683 985568676 -507799637 200639300 …
Output: 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 997422533 …

Constraints:

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

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