CT39031

Shimmering ledgers Peak per Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the quays of Driftwood; Koda weighs the day's ledgers manifests and starts the calculations. 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: 1240 759 -581528528 -358445342 -877737127 -872979534 -789220105 -438584242 440681623 -330505838 271480520 737973377 -849577860 -521778094 -972724583 619711292 379738535 -548574506 145490982 550445490 -959661935 -524840293 571989675 -776386104 -439153614 -765768107 3939328 -420626169 263665876 -602824566 245381228 -990786566 24180092 265305720 551549073 -568339674 592054171 -635485016 -625451603 22237105 152525282 950536051 431267339 681682863 70746492 619814496 -405456826 -974984517 981050069 -341910221 -576806724 -567581999 -72789028 125374392 560849278 133387999 386860695 792980992 43263093 547484690 502239584 570035631 -226835504 -213564253 -226075722 265672904 -264518288 448157870 190037235 -100860592 146884102 146910936 -69694401 -203272898 320483293 -280780378 224459004 -9702101 9887…
Output: 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 999490342 …

Example 2:

Input: 1597 57 -913747723 853329403 -356741465 -649869836 597191672 -407047538 740030670 980680123 989728055 96082886 235129987 32456739 983074429 -171117710 357978141 897733259 -473252634 105476754 -674868604 930847582 864087289 520499775 -949495892 -249200211 885644789 -61724343 845684906 -782914185 326736703 37686981 -612299962 -58394615 -89781418 -233935633 -568680705 794105107 841400891 869509718 360671104 665199085 -294129848 129865346 -247074162 34458065 -59560948 -312096968 -714454263 -931177020 243202751 -135039388 79830013 492744825 150873508 -659300654 -703660487 -46764030 207002697 355176800 803254402 469432869 338462810 362985803 850557523 806399225 802713994 909188998 984786918 -57913477 475487699 914237565 -848428092 57305248 312790170 546550992 -208115260 -351966815 567133263 7326…
Output: 989728055 989728055 989728055 989728055 989728055 989728055 989728055 989728055 989728055 983074429 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 984786918 967334449 967334449 967334449 967334449 967334449 967334449 967334449 967334449 967334449 967334449 967334449 967334449 967334449 …

Example 3:

Input: 915 612 -593967177 -326628429 -323154193 -974152706 671059017 242802254 924615515 -798600897 -549660773 69871387 -616902177 310912104 -308177800 -120796624 -950415033 595545235 -499593783 94852801 -544412728 -335043770 566516642 170597338 -374099027 -556352399 -643164226 19676147 764378229 48451613 734111047 -659256756 729832742 -689817651 -619161581 -825881412 -976220627 -792209760 8356497 -270156746 660463373 9762776 -706629802 730712614 12648935 531592261 881640912 163232230 -553680191 -538687813 346365044 -225839817 -462978583 461938683 486598493 -825565125 -319788631 767931107 -955496725 -98355907 -342733549 -564253029 686297229 540303176 610044635 -373108186 221553897 746356903 350928187 775433903 -614580046 -546137803 554291199 382484446 447838276 -310411047 -301558586 -156406530 84…
Output: 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 996169760 …

Constraints:

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

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