CT53953

Arjun's Caramel ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Arjun runs the workshop at the honeycomb cliffs of Beeswick. Today the books show a list of ledgers, and the numbers must be worked out before sundown. 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: 3064 378 -342597163 545925013 71240092 95012638 18563870 -576017042 -28555357 239055599 627352744 879634926 -368755330 -301235049 -76908027 644255124 -793261987 352923619 246095725 976536446 -689419901 747377686 -75935318 -915828838 -823649219 -70435549 -27396127 -953164393 146061527 -134152217 -137084355 954946373 -205786469 256680915 -270755877 741174569 552399644 803617629 -368426629 -737111764 -943424135 534633541 -756062327 -413528976 -799427910 380271962 -918963614 490909025 -376869796 -762061417 -965259817 638728530 -530585932 -282084922 -990823916 -209054678 583310049 683095966 -440369027 398482125 495448622 -516269341 874181273 -719007283 -948219609 744091446 287935957 -619368408 667500443 921755313 915626244 -111190638 752217290 67015047 528396716 449599469 473072555 -174574091 6…
Output: 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 991380270 …

Example 2:

Input: 1613 1008 -292645426 -884344473 -212426426 -825974783 -963001859 932809161 745827305 750775141 164903155 43407222 -765420247 -716344003 -757879139 174254898 121268181 -918443837 611463997 426487584 -497361567 -571584980 310635651 -536062158 -934068471 -628901708 873924942 668221556 -187122023 952492276 -954557019 -838572411 -933185050 -540447023 -875585362 -599378651 86744017 -714027335 319161150 -595810798 -331962022 734874619 312857547 -366483801 -434377509 926680384 589822696 -877647729 610479496 -907823651 400895254 -509031495 67830946 304942292 -637893185 11833042 -202781115 -551568717 -32472121 612435271 -733456119 -20528133 -463776858 -95933971 957552585 505610854 723602722 -890227337 -256515820 47906384 684155752 -249179266 423061098 -179020780 467932798 -32377622 -830580656 762620…
Output: 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 999608720 …

Example 3:

Input: 2448 1737 57516834 967408847 651304112 897273495 -347324169 638018060 -647040836 278531564 273351890 70418554 -415270012 772173500 656239774 704646308 801205398 -341818420 -398429600 -121989051 -957104368 -154807545 836095457 -760336935 478142340 434825692 -68558640 902482180 -604252142 505004051 -545625530 808527971 -318259137 936407593 878038030 -929008637 -23191005 300907957 576336571 -418986799 -23854715 893234316 -970369885 -230496893 -177222966 694779152 -884617331 714812088 675712685 -845748358 -260246790 -885201585 237101712 -289516445 538844384 85491088 -998320494 629950511 -431677976 -21078550 -466523326 709898506 -760222040 -429516779 -973554410 -437963688 -332576465 958311093 645672317 -523908808 -761807480 -568743517 974330171 -106445198 -607113941 -736613850 -839248936 878504…
Output: 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 999416325 …

Constraints:

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

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