CT30583

The scrolls at Mirrormere

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

In the lakeside town of Mirrormere, Dorian the factor keeps careful count of the scrolls. balance the workshop's books, 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 <= 1194; 0 <= a[i] <= 1000.

Example 1:

Input: 218 60 660 149 83 533 183 228 61 686 131 280 747 117 335 126 894 2 629 330 950 976 485 522 986 123 630 974 220 514 144 999 790 842 897 641 873 632 161 342 893 536 254 993 678 197 176 804 109 685 125 413 364 130 523 718 973 941 325 440 21 481 820 999 633 1000 577 723 181 64 347 264 868 8 231 812 58 858 933 283 218 314 307 373 652 535 581 892 696 560 239 60 192 432 983 993 441 133 475 614 612 456 906 836 867 320 278 717 435 952 650 899 391 532 504 307 412 634 963 548 582 457 887 943 545 51 500 148 406 572 51 517 205 230 458 529 327 419 226 221 517 227 707 324 753 291 519 293 222 394 961 596 77 132 428 319 295 427 403 930 94 928 114 484 138 720 700 89 534 598 847 70 725 905 469 7 88 544 886 131 258 738 993 367 112 129 222 440 665 850 720 644 53 287 993 1 812 942 731 215 605 956 395 480 559 22…
Output: 25014

Example 2:

Input: 547 151 765 749 162 107 308 342 33 830 73 343 110 298 681 743 897 234 119 918 150 870 113 987 126 727 89 676 359 897 461 844 369 216 57 216 731 724 784 156 584 481 938 428 918 488 878 971 862 167 23 178 742 950 642 54 588 517 373 341 73 163 210 353 24 344 862 433 785 879 659 756 666 98 458 904 514 732 803 147 3 127 753 593 963 110 587 96 636 570 400 456 866 667 990 803 965 94 602 570 512 176 164 757 298 189 752 652 184 176 579 523 586 281 499 970 771 720 382 126 764 320 878 61 377 705 546 399 972 517 488 792 798 701 280 665 574 902 564 74 590 470 584 968 814 443 211 131 139 821 921 519 911 308 281 994 962 466 153 213 457 247 16 931 563 631 358 203 301 804 795 340 655 127 948 570 145 692 876 466 391 0 614 51 720 56 626 561 377 130 693 109 726 370 785 255 614 118 128 363 976 324 173 209 478 …
Output: 74306

Example 3:

Input: 520 181 818 626 918 247 332 992 409 937 176 149 14 6 239 497 36 467 639 347 593 769 797 659 686 869 439 164 941 840 150 52 876 525 317 321 27 843 942 478 108 723 2 494 517 823 308 723 65 936 676 126 742 381 480 176 120 616 901 472 1000 791 424 630 184 521 217 763 866 240 631 721 757 51 390 124 548 659 58 364 767 82 618 518 60 699 935 623 249 406 962 632 790 959 366 242 630 574 988 179 406 371 945 567 101 961 280 635 808 323 251 371 289 631 671 968 207 865 471 384 948 107 453 459 202 828 204 150 463 926 148 996 489 645 585 605 673 444 48 76 603 218 535 779 391 184 898 889 62 731 968 144 578 498 57 967 78 749 548 323 158 318 155 190 370 815 143 757 528 225 256 999 435 667 662 895 281 50 956 19 974 357 845 882 932 138 290 575 299 690 191 206 839 170 798 5 598 82 328 774 882 158 628 875 909 89…
Output: 88728

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The scrolls at Mirrormere - MEDIUM Coding Problem | CodeTikki