CT49484

Marek's ribbons Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the rookery of Crowhaven pays by the answer, and Marek intends to earn it. First: the full register of ribbons. Task: Print the minimum sum of any contiguous subarray of length exactly k. Input format: First line: n and k. Second line: n integers. Output format: Print the minimum window sum. Constraints: 1 <= k <= n <= 3390; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 1228 299 -708681 -401701 787485 425026 -590337 418042 -159834 -444418 -681676 508747 914378 -402984 -64856 -666974 703879 574501 212593 640673 952382 279330 826765 131921 -879798 990008 -560028 -384682 -439514 -471532 -579753 488888 -858630 -491061 196157 -968081 -66977 -305653 -664162 462483 -374846 199943 -458674 738611 105518 180764 -478989 -710287 -729722 -228391 495029 528156 193582 -767885 -862051 -11617 -139943 749687 -821290 939342 527092 -730141 889344 48262 877486 -33574 -688399 -630299 315336 704954 -829688 -936477 -830640 -587662 172318 -723961 -30194 378015 -985549 227078 863365 -311243 -352505 827711 -614427 -328909 189460 426946 322031 422718 901060 -974112 700228 -963156 -959336 -268091 377616 770875 -267604 551235 140915 -905879 -101404 -89945 12235 -323372 66180 298244 -2…
Output: -22586054

Example 2:

Input: 893 136 -530299 -601276 -192604 -484876 245085 -985177 -698217 977463 -212901 -240106 609383 -171220 940946 -158037 672407 -624011 932994 -334105 97831 78288 711680 50091 517279 610343 -828950 774488 865946 -617950 -908274 769030 364606 594177 902210 736984 -594340 -933434 151303 335265 307154 -470219 510483 -660219 -536859 973115 -85474 888424 -804214 717236 -702629 -781417 821976 502880 -267837 705223 -398491 -654436 930857 -793773 531287 243292 445016 -956646 -218385 -494387 -331734 361417 -706865 -764136 133778 -45911 -757700 961489 382331 -114207 855723 595352 -645046 389429 -769808 -655451 580449 -766596 -115666 -888540 740435 -3840 -170607 327745 701658 -420354 -493322 -671374 304585 -828826 -102784 -291859 -957192 745006 -774361 -537902 341418 888639 424410 -501866 427339 -123498 3…
Output: -12276212

Example 3:

Input: 3341 1390 334875 837892 539562 817472 225499 899412 -953832 455017 8999 -467776 196243 -380393 528161 148073 -91563 -818064 -840301 -285151 297820 473407 -892203 66909 -310734 61822 -875139 -389582 -47436 127035 -535905 -589312 587860 -607352 840762 752629 -898305 -178296 144911 365316 589218 -88106 -477119 805369 574985 88297 335706 162058 109064 -377899 415089 407773 -578885 -699028 -515250 686973 162910 -97327 276014 -267198 352871 709179 735769 755299 -381362 192987 977349 359142 454936 66312 -628140 97764 -713153 -147438 426934 -584821 701259 987257 -809756 963404 -86324 -553672 -632997 946673 -787887 -712128 -233270 -147984 -273617 -570407 204605 -39608 -571601 298531 -276620 -355088 650332 132059 440511 40566 567720 -388398 617718 246900 778722 949330 -974155 676330 -665177 -942185 …
Output: -5592104

Constraints:

1 <= k <= n <= 3390; -1000000 <= a[i] <= 1000000.

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