CT59414

The beacons at Silkmead

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Caravans arrive at the mulberry rows of Silkmead with crates of beacons, and Fiora the accountant must account for every last one. 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: 1005 151 721763930 801724980 975074107 311229512 936568816 715866088 -825033000 -385778829 403625203 -844899063 -893304701 664328461 55245117 633207204 349597638 964697579 762604419 748890454 609535109 507247672 -577934135 -622579264 -787523495 465107098 326281375 -445550346 -533353362 587908854 -498118339 76701857 484534338 -716144698 65431543 -21868325 -281769646 870625289 403668549 -782653191 822935369 -747102683 753250493 -276866505 -401011084 -841749590 -885967704 176797694 -365768157 -359506406 108106098 -672559906 183083802 -193503089 -671009591 -399511615 624643060 -420827941 477500834 589489797 -671163376 785043853 -219973337 258752343 698380288 -682156399 841677257 566411913 642922275 810999014 870082293 -951622450 -179972603 435026249 -279618294 426506072 -660050989 -631159482 -…
Output: 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 980556380 …

Example 2:

Input: 2606 2384 204210804 477075873 -537018384 463597023 -142898544 494504896 81458316 377508292 480455905 -969793216 55894909 734106886 220397517 -15252310 627146512 102374452 -51980769 -634067829 241128126 934017018 871966592 73270473 908572651 391217015 911219472 606450920 -797461452 653583920 650071897 -818981286 923135320 95662430 -184364058 179185442 971262818 -167726169 376414649 96416367 854229305 -431190387 374833163 -851570014 539813689 910468624 -153978963 493252088 -252981760 642468069 -330094220 479562326 -470692954 -834722237 152679056 205810126 821148402 621434351 -808427114 769916122 658978701 310117685 -526950869 -8733680 -694354111 407550712 -846493232 -523577332 800610881 306617611 814130052 -514255936 413971407 228037047 -883264409 -428245577 406993811 -35774676 -134927433 74…
Output: 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 999968404 …

Example 3:

Input: 3501 444 880445765 997000369 -155012637 -844486920 -285341530 330194299 303831618 557149651 246463261 695956508 812430962 -885081474 -554184576 849935598 395292770 98022942 829498134 62354555 903164938 -775465705 -938580787 452392896 -262080682 -39852961 184255691 -96832908 -311477148 478131919 407806285 -993371114 706316594 -865332797 -706608455 -972776598 -856225401 323347771 -810656979 123115655 -29051940 496657270 597345021 503158810 830975921 -102206041 -76715971 145031231 750532366 835355766 -657171685 -776980514 752655328 -753695810 -950421662 128545638 322166109 -788137784 -509360064 -16974491 -283020651 -310686086 653905833 582793525 279912995 -254880434 -354849549 -706091566 -928765384 225174770 -284014303 -227104992 -846487739 -957760803 -34901557 -57982549 28518542 196477620 70…
Output: 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 998405842 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The beacons at Silkmead - MEDIUM Coding Problem | CodeTikki