CT51144

Mira Counts the stretches

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the clockwork quarter of Gearford, Mira the measurer keeps careful count of the stretches. Verify the ledger before the auditors arrive, every figure matters. 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 <= 2418; 0 <= a[i] <= 1000.

Example 1:

Input: 1554 778 136 789 335 394 930 786 735 755 228 47 146 81 77 73 502 692 16 39 494 628 714 599 509 555 178 185 700 458 498 350 388 290 102 406 545 394 64 388 790 658 8 709 519 63 983 251 674 173 246 791 474 166 93 930 70 186 593 31 598 174 740 926 970 44 217 568 708 412 355 885 647 523 413 312 501 312 405 251 651 711 190 209 576 651 842 469 532 172 871 740 752 504 670 933 652 473 508 865 220 4 805 323 311 216 112 764 373 809 821 860 749 753 723 608 16 489 628 424 188 453 872 195 860 594 938 750 677 87 759 654 330 928 79 226 246 868 459 391 335 456 737 992 110 964 986 413 519 84 861 521 106 969 326 157 541 196 71 677 684 22 358 14 605 235 669 132 351 906 210 599 368 124 572 787 947 633 894 67 384 558 779 796 195 317 10 527 580 601 292 791 730 518 804 859 887 911 123 442 123 561 268 132 671 152 …
Output: 382860

Example 2:

Input: 1774 1566 905 933 143 250 684 195 171 77 404 304 321 832 209 645 678 877 827 67 661 364 197 774 364 650 449 264 520 356 629 996 60 830 432 39 702 188 118 82 110 8 976 558 255 653 573 53 95 404 972 708 221 721 43 638 761 164 198 197 481 158 892 67 709 220 419 642 207 143 637 944 322 399 978 390 771 973 97 993 817 550 921 389 824 992 612 27 373 936 190 43 967 533 647 851 883 81 347 204 517 545 806 422 916 771 504 388 670 753 126 646 961 618 23 749 626 739 287 226 991 429 591 402 552 589 109 987 900 203 827 620 34 650 733 999 551 400 280 602 228 278 531 128 190 634 650 463 126 90 820 416 153 800 230 835 496 575 853 768 457 996 962 922 434 139 94 147 89 209 913 983 759 450 366 568 517 478 864 501 709 104 794 771 381 188 797 585 135 162 774 300 336 283 130 108 987 475 873 387 833 624 51 145 552…
Output: 790372

Example 3:

Input: 598 420 682 736 410 840 984 941 531 308 798 723 331 135 761 952 687 222 708 404 314 670 882 851 746 368 813 60 948 659 857 398 119 212 861 595 621 976 736 648 837 688 685 259 6 700 72 962 742 834 791 321 961 491 12 152 520 199 492 230 812 838 175 596 255 975 615 917 634 290 680 624 548 293 9 603 684 976 301 177 822 638 571 686 970 869 896 436 17 779 672 630 92 906 876 506 86 686 871 244 869 503 642 947 311 292 964 878 799 827 216 859 913 486 219 706 786 874 826 840 905 548 186 643 850 856 508 283 711 659 888 49 259 358 798 127 698 719 184 681 815 580 758 67 74 314 574 826 245 704 297 586 956 967 499 417 38 30 753 711 404 182 829 880 91 652 449 19 257 247 877 526 405 31 691 812 292 651 585 561 498 706 30 66 54 844 832 487 962 359 744 322 652 331 172 638 908 888 244 424 346 625 414 616 637 2…
Output: 196321

Constraints:

1 <= k <= n <= 2418; 0 <= a[i] <= 1000.

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