CT52201

Vigo's beacons Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the ferry landing of Crosswater close for winter, Vigo must finish the beacons ledger - one figure at a time. 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: 444 190 812991569 -867259856 102479054 798836212 -800013397 237495897 -514146106 -12877389 -294307123 849279868 -928411063 62310375 -477510790 -527183760 -837735379 -414169412 -766631474 687550866 -748493168 -870443357 321450990 482553759 -960586648 -426072346 601668003 533620077 -470842687 161088391 704279543 -565973327 -499237196 50020655 677206724 258708344 -635836520 409136927 453733371 -192252146 975792868 -165129301 -86363895 -9964904 -965962967 -864262388 -359979562 -263540369 -932489044 267735796 -919569339 46021288 654532051 692739522 705555840 -776233824 901370006 -585323400 705416038 -50351637 537122026 328918799 285096332 605620830 453450252 50923170 -14269114 -875710160 408540772 974845272 368358782 457770882 208624386 -422902056 535548423 586482815 19542794 -469565519 -643942…
Output: 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 980318435 …

Example 2:

Input: 602 578 -796072114 155089453 260831582 -216269022 -673050914 -287280254 243896801 -225410696 -527697776 716704861 16217669 -428548466 -29416196 -570380755 -186044658 742910363 498717316 206822453 565199510 472816366 -104754932 590006110 -475310319 308243079 -716941712 -1688911 493122957 579456317 505630535 574499884 162875375 972996644 539439573 -675403104 657305563 -291932774 -877225785 341164996 -695029396 841286227 -758259602 803675564 192451104 -216600928 -254618739 -37480885 929205372 549691617 518505643 -638531102 -851829042 -92392810 663420983 -52708576 406423865 776651139 -755570569 952241381 -277745333 -819846376 397973988 568093381 -887381142 473234114 974091901 -660089856 -118786520 853320510 -253025028 -119513986 498560186 -223328615 -462013050 410930207 -592889748 -273884091 -…
Output: 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069 998775069

Example 3:

Input: 1635 841 658404166 48945720 113911522 -340703040 -613774811 69524112 629513286 -551383107 -602039307 -896671784 965444985 -660706110 813227243 -834241181 -443619846 -16553317 349291119 -708962334 24471853 -851194421 128887374 -671756437 -455034685 -124551499 -5710692 644962263 662791837 -7235748 426718365 970117432 615043916 -756698997 506152879 908745075 544845792 -311222009 864322120 36767737 922481305 708411018 -828240417 911278298 592807465 302179271 770204768 -151738742 -499744920 -309518368 -310038222 -681709611 3634172 159440830 483301148 420269743 -275423751 -228049965 -714669926 -886773043 536123116 -743335924 672601540 544811822 612150264 725562406 740818439 2799207 -19991880 698902877 -370664536 -245196202 396194566 -311213602 -905007607 849231388 -881272125 -158926735 889953143…
Output: 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 997680378 …

Constraints:

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

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