CT57696

Tempest registers Peak per Window

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Jaya inherited the aviary at the alabaster quarry of Whitestone along with its curious bookkeeping system for registers. Time to make sense of it. 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 57 536484973 544024953 -519019290 -472042582 227886198 408078929 -318632218 -802599480 -566483216 571614967 814173174 -518515609 54450606 251210791 -292978085 -74406923 -36848093 -749768731 357611135 700691242 -712324465 73082861 605100623 -511998453 -709070373 570615635 250879574 111010867 831243020 -720303174 -612370531 -100906256 324608568 -127598600 674975670 913138060 -386604236 -650028453 836009964 -889484170 161022938 -575166904 157500873 -496085971 -899366628 641766341 -946967641 -947995128 -170064527 -258451221 806128422 -960225 -868125729 -37873079 -788489646 358144816 -750083116 710796641 -780338693 -674603592 -436878170 -693181075 -390918761 630626596 -80395279 896490668 -835524382 -147782614 621302255 113228480 195328900 -745309441 -727242429 871818185 639485306 456087270 …
Output: 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 913138060 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110 994458110

Example 2:

Input: 2096 105 688967967 -279159556 -356714180 415446703 41895723 908161644 -49397869 363831892 31960274 -545007951 465159984 894221358 404057160 298486884 297400048 -45077453 976108514 349872257 -391948678 -813018706 41890027 719359554 534295543 163889181 -257874245 212862341 -737116164 -794466623 381270299 -362093779 -850445359 523640036 908178252 196718594 79921563 -703122732 -488302334 -170073495 440330042 -999986426 -974289932 810711023 748838229 517768915 374468527 -402039238 -570221791 -56849650 900042263 746070807 -744368538 786091742 -978633159 876246087 218375518 899840990 -42322492 -198047779 945142204 -237611014 603609949 -936615512 130180947 170818953 -597788244 987862958 560488528 -921947968 -634112276 -89490450 -136450408 825861589 284906142 409881937 -899324240 -834947911 -589980…
Output: 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 987862958 985610567 985610567 985610567 985610567 985610567 985610567 985610567 985610567 985610567 985610567 985610567 985610567 985610567 985610567 …

Example 3:

Input: 3627 3444 743424801 -117821811 -843645744 897426860 51869052 216515204 -868578283 393443154 217572435 615983044 -936805851 512795653 937358239 92411709 -871786616 -841680933 638098895 544659318 -178318756 703744544 -965076586 884940782 721717064 675394593 -967164887 -816012516 -305564640 -380113026 -252566312 -807707716 367340467 141482242 -827733680 -167222128 232437763 556762244 -111213405 -451035661 997952857 969740819 -286863918 699042652 -955075176 791326265 -68578646 -785321267 -904433475 691332982 -656354444 -378875863 41811229 678240102 122705089 -188350386 402499798 -778695030 934083275 153977642 -190665582 399340296 -958719408 -687118301 -875751826 643663029 -468569527 648833554 601947365 67211376 513279164 -645801519 -952898217 -100955717 342087156 -469853343 -441283617 -7438959…
Output: 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 999924150 …

Constraints:

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

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