CT61305

Bhavi Counts the ledgers

MediumL6 · Pointer PhantomAcceptance: 0.0%XP: 100

It is audit day at the honeycomb cliffs of Beeswick. Bhavi spreads the ledgers records across the table and picks up a sharp pencil. 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: 3053 2986 922866695 916668949 920819364 -219353041 943649117 757277620 -186056734 -153480974 653356356 -454025047 -901750500 694545112 -598337032 -699980285 120310153 -162199503 -576920824 -978402355 -572275604 -8498168 -697657300 -183458266 234793469 -797394904 -583128163 -370243555 -957368965 888812024 287694855 -714289511 713558670 630019538 -916719469 60799063 -38689696 -333909932 317862741 296655077 -367809659 567362281 319072344 -529070756 25063615 -677743593 946156674 -529318252 925895964 690154445 -287205331 -511773131 898809967 997843189 278342497 639253980 -715321040 291276348 -84962123 126735611 480537399 616605538 573839663 -542894326 -971726685 -985983155 -74154847 614072719 -429192684 -833152406 236522807 -361826140 -93240207 722170900 156084786 523188964 354977679 -761249340…
Output: 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034 998095034

Example 2:

Input: 2881 2480 665943072 811877832 860179177 -199274198 277328304 883170046 629383246 839772649 -141827403 -719390435 730750402 841021943 914308375 246823627 -639869277 -6869005 479524019 390884781 277552750 887540580 38168537 822866093 791104516 -208427243 523094879 896241172 600144285 659643401 16815789 140109031 -668396582 -95550438 -912142000 -563703288 885196804 -489760355 -565984219 632484317 -207616931 -156483908 -53064574 -481639568 -557358154 -727344569 -569538712 -94693344 915043356 709342792 35158538 -492667154 -151005782 633386739 159074014 -912272222 562176861 -177195167 478539923 -679228621 -477826816 857846538 -402599736 402502260 395954633 859325525 298652328 -560898710 -732272580 904409951 107706368 553575411 -406318540 594094134 -444984485 -556869556 -684081838 -908987020 6359…
Output: 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 998879953 …

Example 3:

Input: 2868 2125 -562858845 699089461 179626375 744713265 27460948 192934665 800159896 325760470 251709050 807869367 956870787 -976075930 -451577379 284195463 207039226 -447846297 984769902 -132598821 821156189 572316280 966773724 -122586160 -486058782 -485394810 -575448761 -139641433 162700804 -699984496 -111085136 114176586 -537647616 597506763 183588217 -53152294 8439316 332266854 516946061 -71699538 -361678259 500545776 671019714 -268978296 319147022 -313223312 -24122750 695364297 432956838 -34470703 -628426445 -670519644 78020920 -738951162 -957074289 708984420 -650223697 -764417009 695527370 260530682 699617056 -132879900 264635254 465746385 30619439 -840876107 -130929933 -160289575 -718296573 -873335672 739654285 21690704 165435002 -2130909 -489754834 -35088427 -969440725 134781949 -690855…
Output: 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 998820123 …

Constraints:

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

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