CT36978

Last registers of Rowena

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the ember dunes of Ashfall opens only for a perfect tally of registers. Rowena means to find out. 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: 110 4 768286162 67660081 417547435 867621445 -355913845 613879804 -993869997 206999257 910278605 820376105 271670516 -631874954 927724821 941745058 770602876 -286995412 62845740 -872041066 505803651 -162480326 979101322 -236433917 125580040 -322605816 757293733 831723670 -585749106 194071494 208323856 -10730716 -426077813 751201192 -899257832 511729622 208700830 226264041 -239158295 929005853 -210776563 325790895 -245676562 248498900 -834637586 -935122725 -965565672 -218721567 -257269325 607430937 -668935647 -423789362 -117973277 923856896 -280308382 630334194 410757776 -322671455 -517844158 187514706 -465681563 -798316922 646516609 172823687 872693783 187708887 286138663 -150151361 336184672 115511976 -87054461 -414748179 -315556660 384318359 -728664917 -833480295 226765150 716519627 3172…
Output: 867621445 867621445 867621445 867621445 613879804 910278605 910278605 910278605 910278605 927724821 941745058 941745058 941745058 941745058 770602876 505803651 505803651 979101322 979101322 979101322 979101322 757293733 831723670 831723670 831723670 831723670 208323856 208323856 751201192 751201192 751201192 751201192 511729622 511729622 929005853 929005853 929005853 929005853 325790895 325790895 248498900 248498900 -218721567 -218721567 607430937 607430937 607430937 607430937 923856896 923856896 923856896 923856896 630334194 630334194 410757776 187514706 187514706 646516609 646516609 872693783 872693783 872693783 872693783 336184672 336184672 336184672 336184672 115511976 384318359 384318359 384318359 384318359 716519627 716519627 716519627 716519627 317230409 -156918329 -156918329 -26114…

Example 2:

Input: 629 232 100719583 782556584 734761615 456018361 -339706578 -917362893 -188090539 -609326537 775680804 -393186973 49875225 -524782366 240960785 -587850146 743566895 28494043 -909071810 685829895 636710452 -588923224 196429364 -957038735 -3997712 -349270658 697856496 85886988 -291058751 326462012 151337245 -585777944 -991568666 -185156432 526830633 996555852 -24486869 388847218 -525018282 -833879769 912492162 -195540431 650548030 -156062373 -286617508 -659476755 305584815 790194626 866385448 -944892910 -493391538 -849563833 -265611134 -689629170 753503511 7333311 -752093584 513678387 -694195146 255095389 -542266392 -706269770 877828392 -121875968 996733282 -875495476 -747944298 857757881 -76442480 799443952 671097047 -302033337 249880924 -691989959 -921333969 256856918 -921759942 153110012 1…
Output: 996733282 996733282 996733282 996733282 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 997329619 999018781 999018781 999018781 999018781 999018781 999018781 999018781 999018781 999018781 999018781 999018781 999018781 999018781 999018781 999018781 999018781 …

Example 3:

Input: 2947 1174 -919866312 -51799623 -549842342 -803379780 -924086373 287853285 155175740 716525004 884850672 -312236942 -786363206 956937954 -893686836 -167660822 558053162 159785921 887011175 -526946004 195721961 14561528 -280463442 -195164222 61173719 -470543942 -18347225 -934555838 825027310 -565156325 925625528 855071634 -663387909 -447067200 983920447 -933857440 382390753 -174035541 -203061917 476438511 624363050 -341413518 -990034511 -143170166 -913493003 906593525 -451076300 -248348772 -528285870 982862780 789180595 588106131 -932667253 -251022700 766155212 -390241054 -767837634 424770178 -607606010 -758901421 -880540464 107539005 795904533 -889793596 66785607 84055404 -770514055 -138148778 498392830 485520038 366208406 -748854634 -28926221 533424715 -367174349 -808557132 -530895750 -527…
Output: 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 996739043 …

Constraints:

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

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