CT56841

Ivo's marks Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the lantern lake of Firefly Mere close for winter, Ivo must finish the marks ledger - one figure at a time. 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: 2946 698 -656710484 -581034364 820580392 533773528 605627465 794179118 291513576 -825544628 246745106 253352561 -50691685 973009101 245411195 807238971 921348936 7671838 -313832034 -78810317 331585732 99188660 472662863 243956540 711610989 -810194413 303407708 -287249675 412965342 825426583 699112977 256008822 313612114 -419215140 705871375 -265715745 651128433 -111391102 14958632 -505485950 355024827 -599227030 642217630 -323667332 948097565 -993721207 -48820471 -312373393 -430658537 973021690 548389324 133012110 621393157 -753052078 -507201609 459993039 265414631 -143792653 -362473451 -766333424 916044722 -883065870 -347784446 -70804847 744206544 598991791 268287539 -509554564 6392729 -253263124 -134732111 238330880 842291454 -768205532 -290205435 -510012150 -604567519 -502270201 -191263…
Output: 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 993988917 …

Example 2:

Input: 3580 1244 145996504 535164981 830039993 -424701981 222006184 -78492667 896022942 906520385 212099146 -10118793 -599320229 -217413633 455543346 652405906 -452599269 563583296 892850851 -451499904 90041957 -211801094 557414341 -388954947 671945916 -824746355 -659891538 -259258209 243513302 620774926 61500170 -654037403 -869326469 -586648217 380084737 -568260598 -565748230 294598741 707124195 348957215 380094180 -656634791 -536348580 -257740129 -221327275 -14841961 -396762126 -930479450 -24374196 -189759944 221829659 873467029 -153288031 194312697 -301029544 774770135 -601013388 98873037 -272763817 534037491 -627160431 -248541073 316774545 -89294271 -219895894 -921972524 884964826 -771191355 332524124 738938694 -375703020 -807901028 113641470 467194885 -446007682 175577624 186535667 72363410 …
Output: 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 999305128 …

Example 3:

Input: 1526 1061 460757641 -458293781 -947481258 873524957 -262007796 -643757625 689899190 587682644 81253397 333316764 -603219889 943819615 -462177591 -741893637 -186817677 -635534386 385066798 371708742 43980068 402019765 793641938 206764675 798703670 31082067 -80734158 158971283 376848289 560227971 -840233493 253093266 745714227 174349043 -588052780 -134961562 89637993 -668253555 838120513 -934753064 896085210 691414335 -590764249 -176254311 15414243 669434896 -490097369 198505525 -735852701 772658302 -645703930 -189038872 -683916323 -414690696 629240978 781474782 -292364349 -766154993 403191259 598757763 530894927 664105087 -324372226 -916016330 79351738 796302299 -12319399 872221219 -442896120 575189168 -960897244 -563376447 -334106042 -708187300 888587868 365117565 -179822403 -532854410 654…
Output: 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 995995516 …

Constraints:

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

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