CT39850

The Peak per Window Beneath Barking Cove

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the seal rocks of Barking Cove pays by the answer, and Rune intends to earn it. First: the full register of ledgers. 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: 2605 672 -646236556 364111866 -409510912 -729400955 749722990 -524438266 -77295513 959655539 596466897 -334265907 -347358159 834284762 -405198019 -373163976 -905964795 -217429338 851502756 898486200 864156678 -422585592 5429448 841204165 -169102920 -247863968 -578815789 846403185 -771368797 558212049 683716316 525003960 331165081 146935366 -689399838 245724245 -993548912 -399336327 -613546187 -929490954 -773181766 -367379072 154618905 2163640 461420957 -772607974 120337210 -301489377 403264337 -46655840 -480459092 941120217 -281100832 289589963 904235559 713962066 -457675488 113350492 980024908 -186490939 432202133 827835717 -226739251 314391966 433190359 -928155247 -616332374 407758213 -97904953 63717669 -641177202 -160341104 -442868719 476092317 -220082291 85038884 -951107802 -432149660 …
Output: 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 996352315 …

Example 2:

Input: 1621 492 -727149888 -328371715 64581744 88622158 995673703 598285438 784106109 -737517373 947298761 -106737418 121492225 352319180 867757613 350219478 908482469 708835025 545064896 84017278 888051714 -997672292 -172370678 -865149275 -824845145 -467800540 -662163131 50970245 596814059 -756761399 -724570664 117135146 -702219014 -23203585 865022366 -704768301 321913668 -274993528 554932227 -691292345 -302270631 941317451 409789741 -49579086 815264257 716936746 -882521562 -623610660 484252280 253214173 -528728427 678829663 316990417 869085491 246334748 -864214514 -73631937 -828964602 -72252142 -75313750 -300582074 -693278198 -92721045 -488553027 -179045690 -501926967 516104860 457301681 902348565 -904181793 615175679 658601228 -909174453 -410958507 -787607273 -448181093 -486929032 193339343 -4…
Output: 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 998841692 …

Example 3:

Input: 1211 1156 -696325083 -976525930 829586323 62454808 -497107186 -315049236 702260525 -723001619 -993453258 -634995821 -91845905 -698186641 83852587 -813722044 -521777740 -770217244 -368323091 -816410619 521707503 751601183 -657934316 327181648 -653434147 701007663 -345013979 -270158508 759815969 564912853 102473400 -15884549 566700549 766591206 529679037 584948647 396832570 237097752 316731002 879882497 301887110 -599225276 -895724165 -241950616 -409838861 -492568874 185700463 263231590 519849404 495821901 -280070928 223928055 821921771 745508309 -187372554 103785375 730026588 908799609 -698602693 -213099124 -538131681 -495067652 -962220303 -863952093 211568533 921691092 -64861981 528439828 -252667109 -13485898 215366512 -475309303 -981921986 -618991458 971502569 19896778 -506805355 -6237853…
Output: 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735 999673735

Constraints:

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

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