CT62814

Pearl beacons Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

The chronicler Lysander has been asked to plan the beacon maintenance rota. On the desk lies a long table of beacons readings. 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: 535 414 153458101 148577312 943882697 754121650 512954524 -334749705 -168213197 100186531 396241202 -235315586 -283870943 830648895 -65764600 625172828 -320373200 -502328382 582924594 -8395947 916538981 -59566263 688704509 678743269 -266814841 -347146435 376207614 563159023 772235965 359538416 -960509065 551810467 -850920535 59715488 -396366812 654914048 -287806895 -616413469 711631336 517254322 660198370 -528266244 -230964884 -320042704 -572536798 -72014108 310192393 -800065274 -297022086 -423659060 -523860822 448785040 -347407404 875423779 -383115049 988790521 -955463084 221033162 -265182982 -377894412 -176759317 -77391986 -822446430 871504231 849627265 -8442086 -914433842 -994455206 595513170 -728070408 -367267541 706936315 -436497391 452794033 691588702 883792678 886990774 -958014833 -…
Output: 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 997694690 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 998794091 …

Example 2:

Input: 1452 1348 896756875 765411455 -272291452 -784186023 5048614 -77801921 167536116 878845205 -917838846 -314417931 596707766 306788191 -225333535 27165892 -375271492 630239748 883318176 -143985012 591756088 -351143343 -393195233 -296669452 -477589526 -268186923 713405193 626841648 433725332 -750204305 -728750217 -211982791 -76207153 130529254 386758855 -378829481 -404715867 741136054 -387891794 -775705906 -662586380 580360257 -787202881 -780196537 -93144426 -320481655 -325558804 -298550457 -376763408 640059117 -777750180 759373847 -780272681 750153030 615789967 203612586 853902347 -509474925 945270596 686495657 433347837 -375711160 -714759009 943950680 393922701 941008821 -831349111 -849310540 -586003885 934425872 4131929 333707539 165306634 -248443756 728622468 693026179 -500764276 -93034931…
Output: 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 996527540 …

Example 3:

Input: 1940 1130 -790007432 518932544 -251082121 830003671 -430688369 588840942 318790115 -388510430 114779890 472343041 139738497 -983750890 730933593 -556277539 -984239920 310949959 810555452 328959534 -92354162 517111121 -573822364 -306676943 -166943891 -551303407 683618223 -597085791 -729032308 13535617 -619156548 275406569 911727473 698403266 201677332 -541632440 127992198 -380454447 828420493 805467222 -687430818 564264567 75832193 -337981730 699877232 828777449 -212113513 153518339 -469851499 848937807 936423679 -859279422 -145765048 -87553306 -107446440 619919567 -819282406 817601588 -193998159 -865790585 -259792550 346757462 -529759206 -974278842 954042889 640310300 -618648173 -520589099 -875813758 -268487218 38815553 729068731 386010488 913682954 -128656844 921865766 -291692262 11349878…
Output: 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 996955719 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Pearl beacons Peak per Window - MEDIUM Coding Problem | CodeTikki