CT42682

Isha's registers Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Isha runs the dairy at the heron rookery of Longlegs. Today the books show a list of registers, and the numbers must be worked out before sundown. 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: 1810 685 67561054 -817152779 552870674 -903383393 -772149007 -817611131 -274573645 -768153257 -575580065 236299333 -565475308 -831919886 -270697840 950307126 -635985096 -888204368 -385903334 -700873928 924920106 651533547 992499132 871854630 804023329 -297720036 292913547 116106253 711193084 -240306369 984145142 -270218576 664620240 -751068122 258684468 736302302 -635804183 375742353 -481487361 828145294 572776832 721160108 94505810 -534548354 897702571 502685928 -791510840 -432892357 -793171081 -492056572 349954849 -765361329 -79116672 888088387 398145871 961675806 -281172636 96976694 -5011309 304717704 -338120675 -733529368 435874844 116594574 -317688425 686563478 -895714532 -322981595 514916260 -556338551 531291701 118795432 -583268284 -943614649 -751707839 -630911192 430114534 -2354184…
Output: 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 997177022 …

Example 2:

Input: 3420 636 -566605681 -919285848 823200422 233556773 -451115411 -504938608 984006913 -722612452 587879582 -43385794 926833542 803420517 -623059302 -35376274 -233692608 -451629970 985515611 175497101 -912471267 451921053 659351813 -450632253 786947561 -228870713 -735691796 622741358 316276624 234662941 -984221419 428662085 274972995 278367126 -579353221 -200793121 -381920822 792326676 15826813 -915424243 -987043152 514900797 -157479336 -929398702 271242991 -33617347 634089409 -437132133 -72487063 -544190154 -608335203 245863743 23763427 283080189 -469146841 -594863850 574842726 -998407301 -692161287 -625288854 -144883162 -244263102 -698650478 -531148250 935787 174386916 -626381062 -240237518 -858260730 -104209483 906948263 -568603209 948559780 -111301576 -981696295 232606247 -163593014 -31955…
Output: 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 994615917 …

Example 3:

Input: 1020 880 -309579415 995860620 -8028889 -832789031 133183103 -75091734 -555158654 -83547373 173237094 -632110571 -959138867 723871975 -851103583 -792426291 -667511624 -171604325 911183381 -687061891 821324167 234703307 -960283910 29865108 809705980 576138004 543213292 917673214 -859714384 942466698 214655603 -32430989 -363536416 -251389442 -394962701 975714534 755153680 513453790 873997578 981306499 -638861886 -236807396 -252759514 -30589708 -414982550 -826871266 985026090 -367530368 -996645643 -100475503 -103225102 377506699 872915934 -402246904 781362028 485413283 246731514 220320702 -944991777 -801671051 106663091 -693000921 -9550553 -480454017 491861577 -974583888 -511947507 823231242 -85269688 -909539179 -237055229 728505357 247722049 -442534624 -478798214 163091880 -806816931 -8862221…
Output: 995860620 995860620 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 995587693 …

Constraints:

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

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