CT50717

Last stretches of Jace

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Jace runs the mill at the zephyr cliffs of Galeholm. Today the books show a list of stretches, and the numbers must be worked out before sundown. 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 <= 1693; 0 <= a[i] <= 1000.

Example 1:

Input: 655 417 281 413 370 649 333 439 611 268 15 520 769 873 425 319 455 510 980 987 126 614 118 161 426 373 219 777 70 807 875 698 221 602 109 364 219 238 767 142 736 913 123 151 843 152 76 856 15 362 908 733 747 241 344 672 370 897 567 344 503 570 408 115 459 677 386 299 318 290 717 616 370 484 463 949 369 169 833 564 494 753 557 968 295 847 615 372 267 858 153 990 562 304 404 913 562 403 462 711 681 39 127 529 598 398 116 433 262 250 237 930 804 885 963 992 132 888 870 171 964 554 75 523 851 245 751 134 754 49 397 910 830 76 673 328 559 677 706 844 195 613 137 231 516 299 425 829 636 997 129 233 328 298 955 683 935 95 308 309 74 366 583 793 193 877 380 607 473 405 172 314 63 730 64 235 333 867 327 541 581 864 877 295 758 470 280 583 998 349 668 509 577 424 80 475 789 833 250 679 268 71 958 89…
Output: 209287

Example 2:

Input: 1226 756 838 936 842 3 66 135 73 898 920 75 575 35 760 792 475 522 559 171 381 852 622 944 811 687 233 464 961 685 903 383 625 794 57 583 988 936 420 117 446 860 867 679 756 718 259 463 955 935 492 191 562 747 979 110 70 157 203 711 635 961 787 755 921 576 921 744 207 745 927 791 236 656 824 74 962 48 831 280 578 182 831 107 604 459 487 682 272 657 311 833 696 10 755 729 100 340 987 769 540 17 399 412 407 350 450 31 341 520 191 318 112 336 890 68 43 304 887 593 412 151 246 821 409 981 823 86 433 413 362 41 659 854 778 20 113 668 590 966 839 813 16 561 373 72 775 993 228 833 98 715 580 106 385 400 489 400 871 613 906 78 143 796 491 84 516 863 277 69 405 563 491 973 962 295 265 431 201 449 669 487 320 989 58 256 951 6 822 813 552 869 551 690 121 991 398 546 444 148 576 877 245 1000 261 971 2…
Output: 366865

Example 3:

Input: 1227 1013 110 732 214 496 760 565 17 624 953 355 997 685 570 563 585 283 265 577 354 416 156 524 936 857 870 67 475 152 936 367 101 128 503 236 757 627 572 646 443 616 360 779 103 255 195 998 43 552 868 905 454 621 870 104 963 787 379 4 821 243 666 797 437 404 647 817 728 598 268 144 221 902 387 302 337 457 569 645 164 140 801 452 154 151 404 301 487 794 607 695 214 167 807 730 654 948 314 32 656 220 749 693 638 249 192 492 532 462 520 405 625 729 622 298 475 911 368 978 926 465 957 313 725 757 883 937 431 118 781 688 438 231 625 712 908 748 834 852 49 963 773 953 228 996 882 819 37 458 811 570 997 933 107 424 45 747 388 849 998 553 594 914 267 972 738 12 692 233 508 537 364 272 929 78 175 117 797 161 824 616 229 56 892 407 403 785 873 631 567 563 708 254 437 570 628 112 662 526 628 538 71…
Output: 509905

Constraints:

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

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