CT38244

Tanner's Ledger of ledgers

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the shale slopes of Greystone, Tanner the bookkeeper keeps careful count of the ledgers. Track the breeding season, every figure matters. 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: 1813 463 894616414 392326296 -608425747 -262898485 -93684026 -420330196 131175196 -365107726 -362794516 -420934693 521664593 3957176 -242447584 -269200123 502353741 353729141 -832063540 263693761 -142918263 -34104743 696120266 673074802 -491540133 497532666 -547365717 709712144 -529443750 -71581654 470379471 -113873287 250898075 657236622 -78098278 346453635 59255821 742227217 -465795293 129444044 271819588 -522229227 -625656892 -503833051 -261466313 -204300973 -413688025 509591646 -401306067 -847109260 92925578 -688376235 -405879924 -183324505 -660744086 570633588 650746038 -905225406 -624449090 -547785215 735784951 400476259 -962517224 712901570 -372145024 -90479874 -880614 239907809 590676427 -625148863 85489990 -881700207 -774408118 477108678 -287681291 -486389431 -28284994 975278971 3…
Output: 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 991884249 …

Example 2:

Input: 2684 1093 -690357202 -992733529 190645127 -674754596 -192394863 747959006 -782827443 -316735941 -249838476 -112826445 -559121484 178868288 -397127399 306951210 -238497119 512447364 -762924185 -752334536 691484940 946645688 -46003678 -837301971 -933152419 511746463 940684134 -149550811 -315745800 -577065045 -712813686 727999887 802739908 581145064 -71266869 948191589 -332686288 461783683 -829228959 434295851 244024766 -172839694 -567051272 -732556868 -30800064 822123247 -80860020 -469531674 872301349 802054352 487136374 706604561 -773757948 716417814 -212688537 430510409 634182570 -710837862 8241963 -368190668 607806458 -348063877 586832660 -658956900 -209113504 -487911755 553191246 -641923729 627802003 84258385 260653809 862768006 98123104 -753906836 -945593461 -285988361 878582704 5620205…
Output: 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 998024130 …

Example 3:

Input: 3115 73 269484842 -285853470 667358336 -818435036 751357582 127672254 -654551125 411326418 -793464140 -464871644 77399439 620243473 -423590210 -591304281 -568932845 -487557044 835151188 652596712 922385257 959225837 -967883357 497944961 150247555 760215884 -119122447 -935302232 -750681232 752270822 616539901 337666723 -828637586 -28527117 598666814 -855566053 -552569060 -500614422 -712944098 -954408920 -863672028 54742684 -710376140 514902791 -355423197 -537121844 170928704 415721362 -875317898 -166731918 673978713 79763410 -346640332 -92415807 -403466537 -206998114 -665099284 -703257648 -377139946 974171114 -999673669 -61964868 -967934067 508984811 -95962949 -955158644 43145485 677369349 843446066 -185322804 869460323 960327284 653346121 269778741 -50951398 115219413 -658176958 -386654757…
Output: 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 974171114 960327284 960327284 960327284 960327284 960327284 960327284 960327284 960327284 960327284 960327284 960327284 960327284 937373663 937373663 937373663 937373663 937373663 937373663 937373663 937373663 937373663 937373663 …

Constraints:

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

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