CT35315

Farmer's ledgers Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the ember mines of Cindercrag, Farmer 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: 3154 2723 752066385 -315646132 -461583333 314044751 383108067 -815252510 -683845384 338263180 833273274 914299388 449069102 475413774 9118853 -890352834 847907209 100636716 982618851 296851121 588234303 519277333 -909543886 601176893 -801887169 -554673128 -70875223 -139976067 871210314 -57288153 559496388 14055579 -260142336 189843961 356019121 -210455080 258911058 -686591936 -792331101 -565283950 -720770002 248829839 112596310 -698096635 823120816 -510132087 -631368433 958922936 -212958528 756022275 589104951 -742496723 -274062999 -968798721 -668271193 678286657 518068140 810197234 -89651932 528158045 765133200 -298189102 -610455287 -75365845 982840428 653670899 680946312 -580721565 -867639212 -431997738 -109135623 985304955 -655872934 -615404687 -643111502 994887985 -368308476 68809851 7…
Output: 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 999975178 …

Example 2:

Input: 799 143 914503898 699571706 548218891 -412591926 227877340 -208434331 547424170 363973573 691502286 -168070455 -406502614 -28295843 -604419106 -996977694 967524891 398751720 -260661930 -320092997 -92503158 -47313603 -969181834 -802036398 -422455309 637052796 -856858932 965475872 -774721373 -797255167 -772223599 -637398745 -460746041 -203160104 549545841 -732654767 383058968 178204116 -964058490 -379926979 371332365 767654341 -723773295 785243506 -80996626 -691483669 -318546697 -119740045 -64680506 -404950258 188216268 664968995 770447955 629955072 -178928798 -919487649 -832894887 866866571 -673581230 120294872 10128000 -27175177 494441678 490163643 -921911927 21224078 -659798285 -125666659 82564085 114220447 -800204365 -940728133 333024039 -429950119 -102407771 -712059985 -207370349 140538…
Output: 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 998183021 986970566 986970566 986970566 …

Example 3:

Input: 583 423 521266833 -795481777 103144608 -339423134 46089313 886242133 607283238 945457100 580194659 334178186 12904805 436830999 361186590 -317109641 -230579180 -527337777 192997665 -864161786 -872944378 -797018883 -649966985 714653031 460313681 -732796621 -783754181 -622083894 -989966072 460724969 -765693325 3532299 -790096894 -398425348 -96214355 519050667 -611215499 184694976 783206597 719582150 442893914 369864070 -729730789 668159926 -409594939 186303332 700218169 324179902 -415812700 -894241735 975286505 -708643010 -300874355 -349598638 281087093 -519638792 -689700130 -501259813 -88249012 520030691 931890604 -917476045 -189020732 983016318 -851049618 -250842671 -883399543 -88137575 -515844148 851509874 797566074 87425778 995627912 -365399362 -676256277 941998662 175272179 631156198 -4…
Output: 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 995767036 …

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Farmer's ledgers Reckoning - MEDIUM Coding Problem | CodeTikki