CT63547

Vesper's Ashen Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Before the gates of the salmon ladder of Rushing Falls close for winter, Vesper must finish the marks ledger - one figure at a time. 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: 1450 674 -676312024 590718388 838255853 439909934 -216611 -519702988 -377619345 -683145704 140454436 -481876563 -921477597 -273130486 -41926929 6606234 -776131531 -867140074 -527226054 -933458006 384146676 198116993 804840661 -77698411 634649111 832138403 17648507 50577475 756164145 576946536 668832400 565756130 613179979 772295156 -814468962 175622552 -400919453 -142226868 730559166 -15040152 25901344 -794132627 -31609771 82529974 -548301258 905672288 -715170615 -610430467 -654021665 -841138508 746979965 509899306 -156208860 534745528 -132968555 -348995585 344916111 -74502927 256681961 -111368133 808999805 798068817 -870176173 31738646 71283056 -203555938 -99686659 -744171088 -135264397 735962865 -76439765 -753388433 -384538639 -950319637 -871260038 -501132163 130547260 399581185 -1311575…
Output: 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 996424194 …

Example 2:

Input: 1480 169 705092602 370556923 230015849 34024800 -488085026 -572397888 817804324 286306077 -196606547 865448292 -586671524 -619704129 -208112890 478903065 -260421368 859575710 488911538 236915322 -982780975 -6881570 838043637 491892509 517451832 -426300836 -488633926 -642122836 -624357000 -883403500 -178876979 368514692 -904202497 2461625 582616766 -430861576 179879176 -581340924 440137601 -394212232 926855861 36372678 -97951401 409145293 -264699794 52404669 -157804650 -687976794 -414202857 -219272055 35376975 733004784 -760721321 367446786 695837754 95740078 -941620142 -62698169 972191970 -813733604 -772832759 8597715 -263389190 430883917 -198839640 -246207906 329457423 576342461 -725255365 808617333 -387361162 -823453523 355462285 427163198 -494881604 -35488472 -372265804 -903197829 93482…
Output: 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 972191970 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 963441964 …

Example 3:

Input: 155 102 45672116 28148713 -862844999 -642947855 -444268729 -915560604 596311905 -820189457 -387814127 -969000502 671368822 -421243976 -865973894 -343844280 474586895 52588133 270549756 585443537 -232479173 -715450678 -734486521 569688636 120231834 -914218712 436339261 -254038654 276446119 -546543568 -321249025 -67849963 817424077 -893777008 -790709138 -992264904 -881737834 -810121198 505526286 153424664 -984735111 -437091039 -752026149 -750112922 790598657 -293736355 -970313418 555218544 951820004 -623761333 -12686012 125548687 -679050026 -527780484 909714981 984626260 -636740711 -711515989 354248049 -426154307 -629492537 292060532 -334376762 71985091 496941572 735758379 806835088 160968979 -363645506 -853802565 -55624888 -357950750 -746622271 604767398 -35081834 -269080475 -658692816 1596…
Output: 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260 984626260

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Vesper's Ashen Ledger - MEDIUM Coding Problem | CodeTikki