CT48004

Captain's Crimson Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the railway depot of Cinderline opens only for a perfect tally of signals. Captain means to find out. 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: 2826 825 560766819 -209945990 699775021 477992786 521601822 99826732 -415897299 -372777220 -945190769 -944170744 -130983579 419796681 186943119 -926189981 -560919202 843789609 -878692400 -825435022 622723109 889131437 -871911750 351325059 878779681 -47117276 -788959524 255383524 811978792 367203530 855810422 -415933949 81808762 930014304 -202467186 239301759 840367402 -562297986 -305441022 18758389 -225470584 -505481374 593812170 -263902090 429918621 -545469112 610403405 -767261433 706202491 834133537 960604036 722898786 -478901567 350225923 -406681032 -789424934 -679185522 -907982907 352429163 35311567 -836015276 886299428 647398607 765341882 964964727 457826111 -5429974 397547595 232606482 -561290806 940075119 909172863 152542359 606968179 -946321137 368105716 -167678540 -229357973 29004…
Output: 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 999257508 …

Example 2:

Input: 2774 2582 -339285961 828099213 -356682658 348022678 -729593106 -278292732 910667464 335086907 -526702263 -373442049 -522517852 313983634 -352464615 -800058964 -176690362 -844729454 30631485 821502580 126795042 448749393 74486076 682110485 -928314214 -337478555 171050639 766552525 -652534370 565434338 -909794374 -112767461 154347478 363809570 -117740937 -840275947 -350036459 94041258 398131970 -145503490 588970861 -884445010 -359706457 144785404 111668540 -616074261 194651844 -33302100 702683311 486183648 219889360 313462340 -677332712 -738409012 939357908 -986494176 -614180304 -103864746 -51044775 57798459 159965901 -647897526 -81512320 241588459 315660417 584258964 -758557412 -621325492 -547765768 733489904 948454177 409875908 270758513 160696532 656929710 674558766 238060874 837500819 -2…
Output: 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 997678612 …

Example 3:

Input: 324 116 -111318285 251684888 836019274 -366027675 -741303778 901042895 -731312859 91729129 -239764522 -647226679 -739034458 628023408 -979444498 -265862197 -673748636 -851470242 63280518 -3727851 155594660 584953956 880513719 -741426524 41604485 -90861679 652750046 -155412218 152104771 737769607 -21368420 -940184969 -231124450 -718142327 1704973 -985174381 -975894423 153056298 -158269786 631878214 -740639377 989043394 -586267834 805653292 -857468602 332462477 675954856 31732421 173274409 840212361 -762760710 -392128590 -151063466 402329350 -950292539 371797553 725073415 843977423 -456059730 81300633 842539602 -101607853 704510034 243488121 611994196 -727925915 618107865 -75642745 902289915 -496229264 -498880352 -247994577 -955521471 751480348 104258272 607592878 886093831 639631583 8916110…
Output: 989043394 989043394 989043394 989043394 989043394 989043394 989043394 989043394 989043394 989043394 989043394 989043394 989043394 989043394 989043394 989043394 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 992482751 …

Constraints:

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

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