CT62428

Boris's Pale Ledger

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

Boris the dispatch writer watches over the fox den of Rustwood's stores of marks. A careful computation stands between order and chaos. 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: 581 279 -762673816 637117136 409675264 968425372 -348269216 -863497024 434664933 -762757421 -167899523 -465821289 -174153695 -289849113 787059015 -976747779 -441956584 40543590 379009701 490302246 172473919 934963438 -665185815 31159533 847334190 -897207118 -855128450 11392377 -755123854 -148894014 -814971869 849166456 423538255 962459572 298429870 976937485 -369624834 712337140 -171140682 166749004 -727117037 -746102478 224843805 180360342 -164090170 -562734407 -421338455 -957631541 -60808181 546558331 -316364241 -384325453 -942209529 -149195807 -690002706 867211679 750242654 -28348859 -565297526 935907937 823381628 -686848548 912063053 -498761012 -726186216 -682418036 -793052984 -885288384 -214462550 902087800 134990851 -91213097 -742237762 476734628 949151198 277145254 387804525 -607436…
Output: 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 996650397 …

Example 2:

Input: 3746 2543 -581100193 -671719122 338905420 -904619636 789889592 -565359132 -437538465 269584828 486982270 -958387240 737016135 232900854 824950730 709864151 -964432291 -276757526 -80618 396852185 -496294215 688798869 287174450 880645983 24088213 -903097707 -48897558 -149632983 -303769836 -471105557 -784818121 -473591105 -622991308 -950718748 -719443730 -304832192 866392013 143179152 271260603 -912511141 -87706093 -532030996 -343206104 172713330 593630705 349831763 -537801331 338882636 -410761548 262974671 165173599 586281976 -413029098 156221428 975902320 -942483892 765633404 -879998153 124277013 -84379544 -370659132 -270873711 -896078706 269088666 672079743 508548048 -573029069 -186404448 445631883 327707483 -760762144 683801991 -901490761 415084424 -739764042 911427870 -226885088 12724502…
Output: 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 999808150 …

Example 3:

Input: 2310 158 841227386 -104622566 -855724641 114536826 -385953740 94151219 -291815618 348605605 505119816 685621334 613932556 19200128 211041313 -361122705 -8564745 -473112807 -132364035 -556991680 878440937 842271146 -749174593 -860870078 -562435752 -575351695 298607211 -227278622 -396064261 886026829 658419996 868665503 682216580 498114727 250835961 835197382 -580632006 -246263274 -943521396 463749306 321908600 -510062888 -82159333 530584374 -776043262 823626904 816788320 -556927405 -680013412 -959634423 210998530 470827391 423785332 789996150 -749805970 -181357128 217968462 268667272 -309924068 -189795997 -348648507 -523392999 665305613 -704625903 -482157145 -462369356 -907844920 138606491 -674786615 -405405050 -442487984 -396384492 -55314541 696657361 270658051 -994651800 -281905646 -20553…
Output: 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 998926877 …

Constraints:

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

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