CT50709

The scrolls at Mirrormere

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the lakeside town of Mirrormere, someone must secure the caravan contract. This year the task falls to Lysander, armed only with the scrolls 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 <= 2076; 0 <= a[i] <= 1000000000.

Example 1:

Input: 79 11 132945207 979026516 517368436 628433377 797222420 803597767 839280341 159194303 559501257 455011539 835660593 873905719 994210995 430441142 435593730 498452953 321173208 845688199 771796595 825773324 759492222 120971736 122798667 997921389 230104020 638337166 290796916 775436627 681355904 276336849 217722147 943690356 309301573 106166188 791093071 657072129 717370245 424401673 773527581 542535105 556189705 768078462 537643576 186294104 140962196 66337293 246402711 966483514 7489604 822656877 195832254 24074796 425216269 792591601 90199950 652425442 883022641 76655323 340257059 973838490 362684536 70199650 161918741 302004228 762804319 411895866 402186109 766091360 193432761 103384424 963148354 919803102 802157649 166292725 893250003 865552895 473059045 687155816 975822779
Output: 3619393194

Example 2:

Input: 840 267 439103204 830661018 597859864 390363946 949445253 684259309 609449310 585518127 235812611 613110348 262897921 474218513 1210861 515163203 234938183 47359878 2516783 555367878 837465721 8900555 120262751 718322586 26687456 869208134 847560009 821226413 986604624 582022419 870190376 30346938 641644685 590229851 365089360 912539298 291682923 44250834 909040047 372935946 624485892 571358161 136658001 865166618 35221735 939828020 481050093 363183241 224718863 562327582 441336155 774387503 280519609 156338163 116761914 131572002 707655871 586909625 850794167 597684963 378168481 699823809 819036968 430549849 495330783 797011028 7189766 65211564 429599885 433443923 70386073 240922895 914846541 872315435 59786075 345562010 584928439 54469460 39003197 699614257 160148353 717017517 904792251 …
Output: 127869524609

Example 3:

Input: 901 168 599991194 789667165 811024929 514313535 703645631 921040523 91775397 987627109 484632365 634880003 46536109 353259272 1579237 511361430 546088199 670250946 345418005 841966096 823909127 113940289 954573253 98803323 528993970 555248329 638952576 227331685 111157100 853126734 284521193 494592471 631334208 454505021 932943875 214795167 453517657 194022549 142579429 951296124 115669560 737859225 442340787 280658154 240013193 455053856 581036309 854008858 717833750 248981139 239046197 773881518 22294934 310457883 526028683 672060639 925994573 493572179 344754654 785551077 523573174 307051859 605014139 173999790 267155531 89508261 118079676 303200869 476360823 574541952 384934089 435840381 111111334 283152650 59944397 642780736 788840394 477313400 608528838 851216558 740331837 638414978 …
Output: 77950774183

Constraints:

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

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