CT45952

Milo's Honeyed beacons

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the wheat plains of Amberfield, Milo studies rows of beacons entries. One clean number will settle the guild's oldest argument. 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: 2403 1119 -916193761 465420993 752895973 361582325 814098778 -265833014 -948213911 -759836030 86887607 -507934889 282700622 -720446019 105175522 -701012836 568299826 196611328 -201844868 -369801182 -222235775 50231720 308131146 -149183972 794028512 596227927 -423237532 192201168 -749145992 -884400550 833202621 879188154 398297686 -547662564 992098258 -286250601 -26273137 -160643861 -530618876 -321334021 -678888921 -179854661 -192369990 134710047 307030902 -756136425 439200696 177635710 62270587 220263957 664315067 562306858 418509757 851203960 -432796794 577088687 693410022 507341219 -312372342 -732469020 -407411191 408751587 766619556 -264791305 601626733 861585918 825487342 688608150 494086620 -334563763 596084857 -226396603 186288780 -652784685 -929909788 873470507 -970944259 -419251865…
Output: 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 997496451 …

Example 2:

Input: 792 361 -934120283 425417695 435334263 -60400654 -783093619 7867139 -130473336 973250066 370899511 -903151286 759746762 -241938054 -416285588 -823346175 293301523 -811367971 -462979758 592621293 -853570643 921106723 139596397 -779202861 344023770 217601864 -682944034 22974635 -903137321 886500562 -783132156 -574561879 -119929478 -732765672 817479314 187333270 682063015 -110211391 -998657475 -690403591 -565999363 -837120762 -960510218 -175912292 106548435 614761890 734767032 -97862900 667250967 -226147132 35466170 -637659340 -765824673 6281129 184985478 712812993 -629889029 -207256850 188546456 -429553111 -347601670 -710855295 -767755893 -965815831 701885706 -104652311 -142892359 125504118 -549726693 -990138394 261739936 217594853 -427266114 444710896 849573900 713279661 761287790 316667172…
Output: 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 992201095 999711886 999711886 999711886 999711886 999711886 999711886 999711886 999711886 999711886 999711886 999711886 999711886 999711886 …

Example 3:

Input: 2411 532 440653540 -948649845 -251854140 25145531 -177030948 417918541 -692074121 31804503 -244360727 -809788218 -530318618 -343102719 -469182786 924569820 719242744 840431808 501167095 -883373172 -343181616 -816919841 520498468 -819182802 466362458 23865224 30012703 781808199 315979019 -766155419 -432227165 -123246640 464498186 704027249 440715822 -740171691 457881743 -194818661 -676009006 428614667 -2081771 824511208 336534722 197261289 -501548961 426475653 -226707311 -660332227 214535224 -956275772 738069712 -497123890 -83358985 742945249 -250163532 298161057 -596166547 -812579065 535082168 10247328 913202835 -480434512 -525993751 -883686631 -354453739 -53950778 361881200 -860633717 -497107116 -287143699 -345778855 -760777899 668703356 -741870747 -830473019 -947122868 862758662 -2868936…
Output: 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 998942523 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Milo's Honeyed beacons - MEDIUM Coding Problem | CodeTikki