CT60149

Aldo's beacons Reckoning

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

In the bamboo terraces of Verdantstep, Aldo the paymaster keeps careful count of the beacons. balance the workshop's books, every figure matters. 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: 1243 2 -801825486 733047499 -706319339 746437026 -210863524 -933313674 716060955 -195175684 128817474 -235389323 -672262082 212361815 -462454637 -586691289 664383249 -377390931 -731173776 751790601 721276058 707272311 271346564 179008059 101901978 98495378 -500211344 -982633906 108523766 55392131 282125660 -339424196 -110815705 491386239 877857573 -204010901 321386434 626755248 -112575076 277277367 366971485 331766775 -433516992 -188712670 -979284283 -91449078 -627940045 589210821 764198248 -416701304 -652945690 400965540 -942067098 222556250 550312343 -852172446 -784445118 787247413 -756884133 718974585 76912636 -323312953 948678619 386954492 -953844857 681702828 -389642781 467278334 -395793221 550430124 309012401 422313816 532682664 860955088 78143028 -345320350 88534811 840692991 638114…
Output: 733047499 733047499 746437026 746437026 -210863524 716060955 716060955 128817474 128817474 -235389323 212361815 212361815 -462454637 664383249 664383249 -377390931 751790601 751790601 721276058 707272311 271346564 179008059 101901978 98495378 -500211344 108523766 108523766 282125660 282125660 -110815705 491386239 877857573 877857573 321386434 626755248 626755248 277277367 366971485 366971485 331766775 -188712670 -188712670 -91449078 -91449078 589210821 764198248 764198248 -416701304 400965540 400965540 222556250 550312343 550312343 -784445118 787247413 787247413 718974585 718974585 76912636 948678619 948678619 386954492 681702828 681702828 467278334 467278334 550430124 550430124 422313816 532682664 860955088 860955088 78143028 88534811 840692991 840692991 638114899 871021081 871021081 8073…

Example 2:

Input: 710 393 -236994917 -470762077 -157034369 -752222134 127113718 275447248 924525680 764027572 -113329870 574432514 257202616 619824566 -9849988 -937066551 809776511 681909066 461546136 646809233 -901472519 -743330925 39459097 672499186 -585815734 466108249 -282108119 -49152605 453525874 641036563 -320313128 319936952 -411446700 -294384536 -98177475 367019791 -650449503 73680093 -66075893 312334273 833549192 76349760 -956035805 522783265 -278035020 524988021 383683644 -422891668 273246033 -48399437 -510728675 587929016 -870992381 870356003 -413351355 939980703 -19406410 -617674490 -616352466 759219768 -613043181 386254425 833931970 329622516 344170606 340772134 388488759 -699991833 -457767776 502266159 -71475179 438154586 -782270605 369308614 -244045404 852506042 753334313 544029507 400236488…
Output: 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 999842378 …

Example 3:

Input: 254 143 -249404925 -248132932 993345108 -509088119 -898872233 -621252058 -529282477 633874775 -17812723 -760483345 825082523 305082750 50071812 -165011936 314705702 274209339 245364286 -136775260 -255950885 81607274 624928847 -8084848 -443296379 -171512198 800379946 690544638 991529726 961370342 123658591 550885865 944428224 -865117029 91442395 713914017 -925769626 -865204700 148118881 584611892 -904068202 -683800275 -339139408 606867949 -105859058 -502908112 783055201 -717342456 919928286 528371585 -584741470 481208156 113719513 888332252 258465339 -255600268 -317609332 -844408378 98937141 47489179 915195958 74463826 774864050 479099059 -264901535 -174814516 950039757 -57032231 -453011501 617093503 -448514315 62209396 994138222 853616079 408420713 -814998031 504390957 -788718619 936224837…
Output: 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 994138222 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 998511858 …

Constraints:

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

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