CT45622

Draper and the Brass ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the ember mines of Cindercrag, Draper studies rows of ledgers entries. One clean number will settle the guild's oldest argument. 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: 3039 990 -55441254 154540521 -27759751 -414347166 -871594797 -906882423 -712756284 411371712 929448389 -332136985 -63561141 -896042964 -463011033 452365809 -879517851 -20525558 -106855189 -861577420 270512674 -495711974 285881175 -995940661 297495277 -221770877 -518698250 -611490701 520537796 -887787381 -689285874 -686742520 51799331 -85860499 -194700723 -755701302 837221653 979666804 -258427617 740438987 -502368681 991768274 501272927 781354963 -965085262 518008610 349526289 -771681588 75673760 -515530938 81948886 465812825 73856244 399312545 -587284042 126471294 -444750381 -745359197 -269183176 551583732 -27995009 -962795835 -668597218 -743751610 -854797977 -34216533 -321085451 622870590 -597829125 -650915923 240825078 -85928233 -180610757 356531900 -902559847 -999754181 -732110203 -1583…
Output: 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 999372180 …

Example 2:

Input: 343 299 -359889965 -727844514 -193586073 140157881 449091072 95496063 -47933364 460723334 964193978 651532689 -868001736 737501651 661389454 -337417623 -463514886 -689889321 -166692621 175629525 -510462559 470321525 800923957 628412620 -699248817 -206394870 306341634 -724983292 -809948649 -172118750 -495680633 -734175115 -572751487 718943881 -908692970 -298338692 -14696273 -651690099 -517437534 -717797976 20693080 746616401 635094254 -844132490 -215342474 -603443705 -412089113 976465790 -912648349 -211134927 748679139 -421203470 -816386619 -186660168 -645512688 -309715408 186521775 792803253 992912459 -435607234 169754912 112849401 -497588176 -319200894 490494858 409972822 -992201744 641645092 -762435772 667963188 100606402 329177599 -307147352 442055546 -170690594 -66499338 -910792493 937…
Output: 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459 992912459

Example 3:

Input: 1778 625 -158716501 304591093 348803182 442222969 -11152405 -830923964 -997045275 691970299 742070927 -388725939 -272881622 879855523 802570115 -985901652 700442354 461879797 49937353 783147468 -861228553 -241800148 976969912 -511382617 -435217570 -4579146 -595943458 529969204 989931458 -700304179 353571397 -409137651 -453441611 -347723865 861079142 323276114 -20800785 -602256372 160517658 -81064004 -487532307 -471764684 568093164 -977784401 294225724 996797532 -537353277 248661286 -514909134 -749871388 -842430970 -428354241 932161281 -144180897 -426999506 289623091 -663416775 -247394465 286142517 609036206 448592829 153676202 -270483996 -904326293 710960853 -403018095 -997681065 -471553058 -527260529 -857280495 607036110 -79512006 953553721 240517436 -122847415 -529872497 274854318 -94846…
Output: 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 996797532 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 994817845 …

Constraints:

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

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