CT50564

Kabir's marks Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the lantern reef of Glowtide, Kabir records each marks in a worn leather ledger. The guild wants answers, not guesses. 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: 2617 808 9924400 -735910155 -247994529 -53090250 -745821092 551533181 559181979 -689495658 506322928 439967856 -786792169 719573624 -625473651 29049521 -963800945 -104521252 465811471 701244752 -550882540 -209768510 216682292 666397477 504771631 -621586467 504103319 -418674952 -121430088 288140529 -527305530 -952098305 936860310 264268917 -283656152 408508044 -642195344 -935901283 688212395 -180098411 391690528 898917701 971467433 661292955 809304333 -311320837 -232358832 61962659 -484751278 331467553 -799573895 -347012043 -666334929 -547645783 -42540113 -46282919 -177192937 -239566795 -454904560 -688549070 680351962 -716514385 512280911 -318248143 362259726 639989926 153704110 899570420 957857024 -587256266 -870637357 -600620579 -924476469 -568697694 239064477 531137680 -874556182 -137730…
Output: 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 995655028 …

Example 2:

Input: 3806 1681 306373032 823617112 4322649 492121020 765083197 -969315810 -82154353 -841627304 656158386 580943368 187760506 77602709 507518116 -270769586 -295233166 -809183820 911861373 -466987411 -449660636 272441553 -393007918 -245435491 -409982226 -430237183 -899218417 -338599206 861958528 833135614 659920483 437491557 674314115 -562703561 403023422 810401577 420237825 939901711 -877132934 274324605 22569321 314306985 404123990 -112197915 -146317298 -908120841 492964097 -434065993 25172615 454864966 -406138602 623653925 -737107288 589304403 -788765002 -388453282 -345155762 619846312 703595744 -321445689 524889408 -834597170 299662598 987205507 695142930 679595118 355606777 941710315 95640929 737866083 -335409011 -926137018 797544298 -684161679 50202612 584220274 -667054696 -784059731 601619…
Output: 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 996784956 …

Example 3:

Input: 2660 1367 -186467088 7092743 -800526811 75865166 539634904 349070902 222646529 -443261613 537372309 38982457 209315438 306322765 -893394593 -777066542 223874980 620123730 314367620 -295743613 -281815640 629336881 563513334 601147021 -351776060 18626815 63653112 395380662 69501179 -561985971 -555040055 -839368293 -752507508 -756996819 -564445871 181456152 198020478 675047821 -912258003 799582104 120506808 -876387654 680911352 619985385 -287935738 -49042388 403145417 575440061 -983449055 -250667019 -614087950 -288580554 -79998207 300181449 147335402 553884049 849738217 7458008 -26421804 758229301 -53369187 -393211574 746640422 947007080 -53681016 -51192517 167923865 684257329 -126621552 -164020880 227727427 -662707623 672366339 -446245199 -556977017 486869768 151318526 163388496 877941915 -6…
Output: 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 999949329 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Kabir's marks Reckoning - MEDIUM Coding Problem | CodeTikki