CT57020

The Silkmead Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the mulberry rows of Silkmead, someone must assign crews to the morning shifts. This year the task falls to Emeric, armed only with the windows register. 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 <= 3959; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1471 1254 127717542 891598131 720616336 479764760 704109639 8991810 80780057 334101146 502940276 172825222 162227116 722057855 424653247 867973138 547129059 358044073 631691196 524781794 183781855 545214251 166552112 358696434 934806636 654552567 551494613 182528665 394751010 246711135 899045120 953602809 125405568 332186522 526752298 664899854 650972019 751920662 338705686 465015444 358533085 501157812 566543956 223542377 34403095 78875727 202185051 759727729 753909641 345237046 972715195 650421286 659595918 795616892 4770653 779192618 920834432 919624614 880100920 323595582 733921653 386942686 713768890 423808064 307645201 440695532 201014478 674207437 677076197 334570992 533808709 745477939 405689902 792094498 511001289 174524045 408890806 635363731 549125001 389335501 68707883 33087650…
Output: 634385434557

Example 2:

Input: 1985 1137 136911250 803133530 414753571 284827225 489800780 546528914 928234653 375051984 122417098 190813045 312024399 377484986 473869421 509601663 401186185 777324921 56919230 254828809 251033160 516793018 312505472 619462944 165707573 94835756 70500673 444617130 923070010 919820992 946191741 417145140 261961104 80737942 466275769 547726787 221457365 284058134 551212636 489528511 649863394 4668378 752257424 514806640 369657353 803699487 534414207 499271937 473871134 885093185 446395166 313782095 188508364 894680816 175810137 126501800 563234023 421723903 572830827 750957196 216024790 719058984 861657973 58069624 186504058 565844435 421657630 596610805 156104980 917674069 895025376 461748093 186639930 639004509 391506940 891351863 152178202 571396971 898928745 15630130 575259401 52730273…
Output: 566555229476

Example 3:

Input: 3423 1840 800522984 696972705 303909733 275782387 806662995 386421063 79681371 706090903 112264003 420746974 870532776 713633384 929730938 95035216 938883390 102352095 901804900 24818550 838223822 791922461 399686611 34563272 329461241 859020630 594680768 172272945 555974472 220597170 286873150 87292736 355114796 530888075 327715037 66240727 743409679 999098104 4220059 869461881 635831720 124950288 817330534 488429552 282071296 751075740 182939298 894332723 847452055 263680917 942644421 30768533 438860280 687975932 24306198 155252585 701681228 874494397 111500648 161408160 592621149 269723226 608528240 402444235 516145356 234217036 327639170 708118179 939539176 898373207 602493972 31169084 96557425 306698544 207774781 484572517 668601118 203059274 103191118 438852308 396085218 515525217 47…
Output: 910924286641

Constraints:

1 <= k <= n <= 3959; 1 <= a[i] <= 1000000000.

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