CT62065

Quiet registers Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Wheelwright found an old ledger of registers in the timber yard attic at the acacia flats of Thornveld. The margin notes pose a precise question. 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: 77 30 -253532846 75902524 -428952831 313719648 691188437 216968207 -536072959 894632351 -49296585 -862804383 -811360030 337240465 -517948558 -681884022 316782304 658248877 598547983 202856284 -900037200 -361240922 -127267636 -195311657 291355365 -769284178 983800283 -734651905 -453293567 -167427531 733886910 898434388 445840704 -31234005 -368263996 457093629 534685531 -44448788 705747691 332030495 622696844 -574809167 141916850 561540031 -843362541 849960655 -324772489 936270639 493188462 677314058 -883051792 834643308 -740268932 -118607389 -817488902 42677772 174686955 422064650 -952347700 657362652 -382140216 487300122 -811625208 236479634 -383713047 365762895 -624892640 -282421858 -508694060 707584375 -111554313 -296728290 503505106 252468174 405212321 -6650022 829642565 217421962 72280…
Output: 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 983800283 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 936270639 834643308 834643308

Example 2:

Input: 122 66 -843955056 -760708746 -594188579 501173126 -494652056 -581908095 -831197502 342610213 327019309 193008555 841121865 146097671 715988215 520432618 923680634 -484979390 604812825 822012626 -431242290 -261857953 503000498 -741034014 110403423 715373178 393261680 -106481713 522504904 -652140874 427754560 -644965310 -512137414 -623246933 925699723 -245704713 394699112 638782506 -272728640 231373733 550710154 213720613 -758537414 -890549925 -684132923 369099220 -877118898 406527977 825238410 -629856109 -246826354 -501373644 816073947 -832205546 -140250406 -298842185 -382542469 -249712451 -465025893 -944514244 -458373064 728235319 -313614616 210872566 309995921 805107114 283645391 476424126 842458475 646007483 -728677243 347658734 55935161 775390540 -61465268 202734325 -216837016 620949298…
Output: 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 925699723 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752 931527752

Example 3:

Input: 1139 205 393613984 -695308484 -524338077 -116150842 -312413949 151612722 -213156662 751148518 -904023022 -867138220 -611683615 298510277 920517462 -650029901 52055083 5765706 919871228 114657446 -151930059 305885964 929524530 793183212 979125364 818908835 481681936 573863628 -161499766 245818372 614019607 -7301793 -24355728 795851603 -157145692 -208454423 -412215693 978544210 -277827274 474217400 658376039 347108123 374943599 -986478803 389614937 384496249 -87061905 -229863785 -899763034 541750744 -715251220 -198625048 -2874353 704792525 746384827 -338580763 980391596 937078222 631105201 -687130480 899947507 -128577531 193780362 -19620704 -577743912 -196650863 -918920876 -182256714 998357537 710716504 -80965640 262148513 355912580 -194785854 888510257 663254498 272004157 -594040033 -595422…
Output: 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 998357537 983479841 983479841 983479841 983479841 983479841 983479841 983479841 983479841 983479841 983479841 983479841 983479841 983479841 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.