CT55884

Navigator and the Pale marks

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the cinnabar mines of Vermilion pays by the answer, and Navigator intends to earn it. First: the full register of marks. 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: 2839 616 -133311195 -220530185 -354350627 -327965701 443292217 682804012 -451273509 -780263909 -94335625 -450643300 244012616 -88861640 886775168 739615820 994508798 597495771 -993308922 -422865989 187458595 -721680483 319380642 468531333 26676021 642087027 270001864 -999791362 135934573 -250661952 442824125 -476633096 842888296 32920407 -603228178 -800399170 -323784101 149834410 815706341 532924253 -958202652 271501923 -614639025 692051943 -552089761 -48998511 -40619137 854378061 41521489 49682501 -713806847 734587684 574526287 721623289 -966222622 -87035249 770811137 -840284210 845648915 -100697794 -388650887 404434035 854211954 70471383 417900811 781878173 969145194 352960223 -29760486 -629070852 293520162 897097508 -449927536 455753602 -934591523 -611751321 655717148 513176905 -8924898…
Output: 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 999765640 …

Example 2:

Input: 2091 1963 987399554 486193689 466629408 54739846 884875463 -634663057 301990075 -364768314 -358228811 -146839126 176436537 -527134460 354683246 862226216 -586468401 270419239 -797028325 367413527 106551592 -863773564 -40081666 -629979940 639687607 -33292605 87036667 -500033565 -392128161 -164844887 -638851153 747819547 -88231394 8590477 174624115 -335864010 823470318 -23022195 -756689955 308635816 102009276 844525986 -448164238 -964157334 -485747155 -630474379 -55869192 137802132 193475263 1636618 -814246679 350359832 -891889027 -840912724 34805233 -946984727 -911271237 199309055 613735 953679157 882512974 128382772 389148546 46781239 -122654653 196415917 595679900 329329486 71023361 525205200 -31633704 464449636 -173076611 -443850336 -441003994 -823781592 203886219 502798134 -595448945 98…
Output: 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 997891120 998281829 998281829 998281829 998281829 998281829 998281829 998281829 998281829 998281829 998281829 998281829 998281829 …

Example 3:

Input: 1674 711 -947411214 -780688804 -235151604 -734544455 352463765 -329537774 94667979 -642141039 -422492577 511408782 745545080 599072113 -763312602 -616968388 -621105882 931832345 812260779 -103561295 122553633 -692678154 185002665 -931851317 687396407 -666644639 856662731 128697252 270466107 393108374 306905970 241845879 236105295 -37456448 -636615489 676419153 88056012 -439949962 -960442274 -967786644 -684787405 247790997 154226498 -239295543 441840609 483113321 -770782592 -544958463 583062253 973221774 990567923 -354993935 -265833426 352554930 -819576724 388192174 -74310962 -547773132 -928125846 472729559 448912407 875857546 -778834201 -781103459 -540757184 226378189 713696528 341495866 554252219 211096475 671479646 937822230 901978142 981393725 -110048853 -521122347 -413825831 447340232 …
Output: 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 998091742 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Navigator and the Pale marks - MEDIUM Coding Problem | CodeTikki