CT49410

Faye's Ledger of registers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the tannery row of Leatherwick, Faye the ledger master keeps careful count of the registers. 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: 1597 434 377081213 -975786166 -15646920 -867169392 578576009 -111638882 953352222 -61583464 514166910 962593148 -291296505 -615546118 208698305 -999990251 680731045 967250190 -897843423 388760119 35147508 -609147279 995742293 -279442870 -458296546 -711569762 -236323615 183168257 -998778474 631493654 15798552 -26428484 -974528152 -414554346 651540135 -173287736 -310100595 -203604143 -838709913 -343449970 861963130 252708456 -611498668 860530494 300025681 425655754 406238065 373741942 -472527257 907424916 758817622 304416096 851761362 408134310 52574339 658204011 -941424675 972430819 803976285 37240927 692473843 -553283875 144782136 323793864 -354791907 -225452254 -199130928 31869790 -58981302 763723619 -309604853 640591476 819516026 747201040 137535830 655194316 -344924153 -551694558 -19834…
Output: 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 995742293 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 993081966 …

Example 2:

Input: 3441 3339 698849018 324438301 -270033532 859946640 -98007594 -378385342 808443368 929338105 -120592016 150499781 811439684 -595979317 271804003 -780834214 568054319 -461324708 791870483 -422029907 63103196 250082976 721161608 -155304569 -6572637 -437598880 767445207 521975757 987222620 -901304255 745720739 355020334 -50034191 301556023 -373567241 511904638 797661252 -688467356 -674009638 -792266532 -629169796 143877320 -161532567 171053854 54714146 -806876517 -691850377 573860206 57802066 870100505 203333591 643878862 613130729 -33984579 575304948 -207528816 -356343391 -920240857 -681786418 -320468708 40046444 -263538312 -58847460 -779011108 -220040736 -213773065 -326808608 -124880375 89472708 4297419 -673802375 646870170 -563216751 -707065486 -92652969 -847104182 901647672 -137089696 -267…
Output: 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 999101228 …

Example 3:

Input: 2331 511 473007546 761282828 927555699 395303548 -17041078 -191774353 -699894597 960418664 -298602683 -135368331 228527416 574672713 814343574 -356369415 -739827188 306172930 -490738443 263888041 -288942869 982336739 -949821265 -30820578 -205727995 179727701 -641134904 -586502945 751646468 -499555336 386708489 -144409789 -494263535 873560095 -877459165 -889813661 379608452 532150645 628313184 -618877210 690025726 617218833 834232217 -689960111 -791672896 -886771559 -933262814 164026569 -304066422 -620863334 184317646 130317093 -143136927 -576641396 -324693792 -310330641 -333436913 -434417496 103019238 -262318855 274389816 -146868147 -833133511 2069247 518150052 509858953 -272337233 -710379142 771018093 -78630000 152777202 -992851072 859501317 155440646 -206431528 982841974 837694329 -33968…
Output: 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 998915258 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Faye's Ledger of registers - MEDIUM Coding Problem | CodeTikki