CT37295

Owen's Ledger of scrolls

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Owen the paymaster watches over the foggy moor of Greyfen's stores of scrolls. A careful computation stands between order and chaos. 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 <= 2291; 1 <= a[i] <= 1000.

Example 1:

Input: 114 12 252 855 668 960 854 251 806 133 782 218 676 604 166 83 8 983 923 52 129 762 413 959 596 123 474 978 746 70 562 320 641 304 989 213 890 27 119 821 771 72 43 609 920 215 73 36 887 133 825 440 894 257 330 502 735 633 9 66 183 307 894 5 624 24 37 57 643 17 923 942 912 818 659 638 320 353 602 193 562 125 622 906 335 398 44 658 969 926 887 620 366 143 914 829 84 854 296 727 912 516 260 302 280 997 86 524 588 745 382 840 158 106 672 529
Output: 2866

Example 2:

Input: 709 466 349 520 956 45 720 179 674 985 649 452 812 113 530 770 622 713 5 550 819 729 1 765 388 210 776 629 867 684 240 212 916 454 833 843 899 817 434 848 790 244 413 970 488 398 157 150 514 281 84 593 352 629 130 558 952 346 522 158 6 299 650 323 178 484 584 406 48 235 187 476 122 238 647 540 448 975 510 247 615 787 220 38 403 202 414 538 73 434 267 696 46 294 905 60 591 104 40 483 513 726 641 765 117 443 323 316 52 147 383 119 276 692 857 902 559 889 801 298 753 867 787 846 577 192 875 803 317 680 679 520 199 818 910 201 979 408 525 859 358 686 206 636 629 442 720 830 253 836 157 815 142 172 524 827 171 633 573 868 345 75 140 436 85 593 441 951 61 558 626 721 539 828 139 320 861 16 300 286 776 657 240 134 777 78 490 632 250 483 889 559 314 501 372 500 128 42 889 276 221 695 332 725 261 1…
Output: 233160

Example 3:

Input: 1390 842 142 290 216 348 449 715 333 933 579 369 227 78 235 86 537 363 845 632 225 499 494 621 792 884 897 995 831 971 919 766 184 942 68 625 101 911 111 796 806 397 546 457 32 758 989 541 840 69 716 500 644 483 262 61 889 762 886 578 159 156 895 216 941 922 981 402 348 537 162 614 468 937 474 777 712 787 514 153 247 695 547 598 320 26 283 400 997 609 877 677 27 852 396 120 251 988 67 33 34 403 63 46 21 136 841 474 419 926 629 210 292 346 259 520 724 467 127 463 729 951 546 774 653 452 912 719 203 72 579 55 190 474 9 399 771 681 926 829 334 71 251 193 627 54 28 585 444 180 192 685 405 763 552 770 502 440 632 468 473 743 915 170 194 518 44 975 751 960 652 97 456 68 450 113 977 37 766 815 657 571 759 988 462 626 580 208 922 428 988 107 200 128 585 111 828 36 837 295 148 129 639 661 615 52 31…
Output: 411656

Constraints:

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

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