CT64120

Copper signals Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

In the gristmill of Rye Hollow, Rosa the inventory keeper keeps careful count of the signals. Certify the cargo before shipping, every figure matters. 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: 322 78 -271805899 -986439334 702932517 50828022 -877747252 582717025 -713702698 466663642 -314525291 468989239 -117289799 673582124 -407303932 -158040803 -980807622 801245025 -521187276 -397214797 -944089426 787169444 -633720263 80009250 -359260490 393058903 480123718 675564955 218787576 -960407307 451870929 -404594064 -720961410 -963325701 697469798 320140932 -949955088 -114082004 -975452369 -859122835 -803406489 13387510 649279286 139957875 -599866475 -951064389 236874227 -960676918 291048938 517827925 -801434692 -417581817 324345141 852652162 -601579783 -393763239 -507454206 -120498067 343633490 -976888483 -121267657 566514692 408151825 283505048 351181296 304235131 -581402013 954096723 141391435 -589182471 470497565 230063136 557203741 -50109739 498650780 -49853551 356762185 872916356 …
Output: 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 997449335 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 998314603 …

Example 2:

Input: 1806 263 387466350 375415905 510352216 185560244 -24670091 -152005942 685185657 56980332 644589898 175091790 -154234862 771501812 203221798 -388067793 327380230 -673188232 -679117363 667273606 -322735645 -559695758 557912486 -664676591 216055003 618454582 38598203 -491582253 547741417 133458347 -388696989 168399015 -60400862 499227768 -146161818 -3045932 -893866236 -513196744 326226787 -382750692 699830392 -8390798 -992096079 571736176 -201335059 -252810406 156189656 182172422 -982046598 -885909094 -671428011 127504878 -356690007 -747825599 330352359 -582680077 -581087793 487212403 35382300 -233158935 851444728 217185983 916199470 -907616062 -773366754 737428515 558667486 628932052 278996879 551728593 212825625 -518699963 444724038 584212963 474911876 762665945 -232390760 -650151600 -64131…
Output: 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 989708321 …

Example 3:

Input: 1139 841 -564309585 596433785 -789862591 -43604672 359500366 415616318 494999037 88093388 -105452975 -317298783 -314422830 589620406 916172613 -927973980 -627446741 -689384005 -342859775 -383614564 -266434578 748665802 -515575177 -310633589 625639156 -246298156 -686871478 269768401 -503473605 806489922 -995090797 248414564 712260968 41230587 -266132888 -461104555 -122302670 294514898 -988914870 -219004852 -337690580 -851241614 -232302044 -887613771 983137885 848018317 885151830 -920244868 -563090209 664590061 534129151 -541952956 752616557 -161723734 48754427 677711543 266883714 964741615 468969426 -69296778 180852107 442970286 780054000 -746023345 -450781693 655308295 -522819725 543804344 -462609568 -709561461 907061407 -563336432 587124503 -832818970 176858613 767137096 660397290 5675746…
Output: 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 999187081 …

Constraints:

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

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