CT62220

Misty registers Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Before the gates of the ivory gates of Alabast close for winter, Sage must finish the registers ledger - one figure at a time. 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: 2530 2399 558538508 665779140 148649834 699951588 673617544 -224870914 -307532530 -314600119 -429340351 173086644 785726420 -472888093 444152117 -40478954 893942433 597575152 -796328230 -784380950 -642065807 990184318 948258957 -888419954 -248831906 412271799 2661139 46215121 856865865 -436595308 42704311 997323325 -538853242 -416513206 -712375872 694342322 -974013579 -559728444 -528178276 -354931083 -986941429 -709285511 63581209 -778955316 998827061 603503691 -536754358 683297741 574435081 -164275181 265947584 561239175 -976152372 -267123169 -561719908 -345739040 783602233 -101211551 971570621 221372037 -739458077 -685989383 -736856412 604071700 -432737031 555791186 -371637853 -988266742 -332842191 935030962 705308033 -508843487 257009349 520418210 582373938 -121760371 -844552569 -871597…
Output: 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 999582085 …

Example 2:

Input: 1744 1212 -958370948 -655781961 375619095 457558399 222263931 -785371429 -928506145 548107194 -695442057 -945639980 569718478 -671339671 -162256492 182594333 673390679 106785860 577480631 -593691073 379753546 306511456 900914524 -344608827 -265544279 -260852628 -76026720 -158048178 -624799338 -627330117 415264504 864633127 100328436 948958248 348352377 -155797958 -662370746 -991229009 123136346 944356658 -377569707 923529895 -138450976 430346954 -663676450 -324433825 743017116 -482730798 815844256 -243914797 118190578 -470346515 -636163215 578681304 -251375980 -658844463 -633881834 183444196 405190948 -681366475 -10057269 679819549 700389254 408167904 110868755 954703363 -278467102 -75414888 197884577 -412148750 11992174 -442479293 -701813864 -180670585 -946249580 -514289422 699021762 -646…
Output: 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 996512851 …

Example 3:

Input: 1818 1281 405646131 -23019426 -284511702 758608016 -594700263 -486489877 617002666 -503786325 565187781 -970823416 506914266 660942126 360448263 -673831049 966757284 -556727174 26348741 771571932 729693385 -744727715 793452905 -8348601 -454144064 -133330981 -949669867 -985449482 436409624 989631474 -416506119 765149384 -185178710 -839778420 -101647549 732247297 -50907757 205042579 273143452 247328921 855467169 752409734 -813958506 -836516394 262574552 -113535742 -208794742 590652528 -767063987 -175631663 632854257 476833738 721460283 161760691 -314747048 -131542134 429690114 -835275247 559728679 -766468529 -792040763 503701804 171480976 289692541 867733544 824654694 688041940 -957371387 476237514 -478686266 -863216895 809197146 95584756 847231931 -218640221 374526035 -929052596 555751209 8…
Output: 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 995526814 …

Constraints:

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

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