CT45565

The Copper ribbons of Mira

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the mangrove channels of Rootwater, Mira studies rows of ribbons entries. One clean number will settle the guild's oldest argument. 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 <= 3485; 0 <= a[i] <= 1000000.

Example 1:

Input: 310 148 312948 246083 913562 628469 35763 522248 43769 850864 122731 53238 829986 427081 94449 650575 987101 776880 119303 565766 197756 209070 851492 151820 943596 99228 564495 517170 240373 657610 110279 423296 273795 787375 118433 963937 874184 54510 238359 887620 208001 803737 625103 200411 81386 236499 339462 68594 891259 510489 406446 461239 940532 193551 711987 138079 333742 323940 313667 80274 561044 173359 198509 265634 525120 104056 259551 606741 5108 145992 214952 675698 602262 958785 973984 301606 632873 909768 737343 148809 730644 206230 964522 460632 478039 667794 808197 129487 202491 308845 374187 416132 681373 107408 635278 937516 570733 600021 931735 912983 974131 246258 610454 273750 100597 957618 809539 615200 603490 517090 885971 424665 14881 779019 430604 136208 112683…
Output: 72022018

Example 2:

Input: 340 340 507044 592110 987199 191197 403080 405443 150360 794971 674779 958688 584441 376126 656947 709362 428365 409819 204282 130811 599023 103463 971111 854109 121891 692836 163817 212174 422304 936227 494043 318069 423376 435463 596718 940731 20963 299004 608877 103611 709700 954473 506434 505649 281190 644860 422838 241528 557154 214029 628821 635605 621924 754502 978713 265627 293365 680060 506177 41342 326704 286281 622627 256558 252630 651058 93546 478235 823003 40051 496418 771131 824635 887793 360449 342436 644050 801703 609178 634613 801806 770694 208037 135643 145958 774963 700111 891134 258661 54630 934876 620159 683280 835521 86641 168695 299060 157754 87446 233839 14899 24253 414042 305484 358343 872975 384236 363884 217844 12139 733872 802288 646180 571149 763482 587949 6174…
Output: 166525756

Example 3:

Input: 806 486 48645 435573 325993 600942 391820 475537 980842 683401 991202 925431 352775 307395 132662 331100 244954 837751 105123 876621 749293 498619 884247 244241 916583 356138 123395 316847 377028 170151 586330 607366 549064 892082 896554 738421 407067 634916 393489 263706 360680 187021 615987 294645 785904 694104 475444 476927 665019 459494 730990 74143 437252 837374 641083 635958 278142 204662 882679 210389 914936 130235 15546 628117 765941 441753 439065 865530 548244 718750 869574 573612 557151 764756 904173 850630 258393 216745 503869 3119 166785 542035 327044 346491 672635 282535 904930 950981 46955 996497 285658 477253 974525 864298 996644 95919 112093 992520 617547 999499 894496 285433 505278 631733 243482 438174 209569 520712 798303 818324 607027 997478 177204 576589 389167 500630 6…
Output: 229406452

Constraints:

1 <= k <= n <= 3485; 0 <= a[i] <= 1000000.

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