CT51125

The Woven segments of Tarun

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the orchard lands of Applerun; Tarun weighs the day's segments manifests and starts the calculations. 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 <= 3995; 1 <= a[i] <= 1000.

Example 1:

Input: 747 303 777 74 452 671 505 987 457 903 62 539 467 41 946 338 685 210 350 557 80 689 22 201 331 899 175 120 926 65 348 625 435 529 345 518 416 919 471 9 234 190 203 878 366 197 772 909 102 909 249 811 763 863 230 444 490 265 540 679 910 699 715 319 628 301 230 188 243 73 781 750 681 928 171 921 189 574 977 68 557 959 50 617 172 626 783 628 289 839 612 491 600 614 188 891 644 530 184 872 838 621 62 481 323 178 802 857 605 904 540 370 956 301 332 318 67 288 343 359 714 280 322 398 580 806 120 937 845 790 771 574 516 430 866 637 588 34 261 468 619 147 213 802 22 954 140 839 782 40 508 713 869 553 945 100 643 220 220 778 437 10 299 896 395 446 649 664 911 653 864 831 757 657 515 778 870 187 258 40 949 232 70 992 365 868 760 711 871 605 438 371 175 557 133 966 26 284 462 208 165 547 163 107 393 …
Output: 144096

Example 2:

Input: 211 85 869 593 525 503 241 38 20 846 502 135 345 761 684 335 749 224 988 856 513 889 875 653 263 190 381 462 340 938 779 248 871 188 486 824 615 522 20 465 594 483 418 456 220 692 425 304 878 342 821 536 913 331 809 965 38 965 457 407 134 697 882 210 503 541 438 112 151 608 944 790 525 913 868 318 160 345 610 307 152 74 267 256 913 743 369 325 623 840 868 848 135 608 49 952 954 953 609 641 309 826 797 473 755 325 797 816 723 664 983 334 673 72 804 781 18 251 992 743 838 562 686 613 783 125 894 203 363 292 274 997 846 699 670 279 13 851 381 61 171 759 765 320 80 325 107 174 871 82 683 437 402 352 143 824 941 514 390 351 523 707 858 396 554 372 31 819 707 969 754 917 432 465 383 897 889 656 931 746 475 348 478 521 947 384 977 356 438 956 50 711 190 106 452 289 578 177 312 316 587 732 942 653…
Output: 43076

Example 3:

Input: 3208 3147 791 576 115 992 183 135 802 54 314 753 943 608 666 759 993 882 254 304 977 508 202 135 149 418 822 932 929 865 644 998 799 482 215 479 620 651 615 24 483 597 694 798 242 201 896 468 147 362 752 161 521 618 823 817 90 58 401 363 413 170 206 220 905 480 513 846 340 76 816 86 723 416 865 652 844 585 637 204 901 522 235 203 567 991 378 24 357 83 969 127 48 798 985 337 587 387 811 38 859 748 685 414 922 256 395 359 420 795 675 586 813 161 360 98 507 466 76 965 592 6 840 646 589 374 670 32 768 121 551 236 558 408 49 421 851 112 974 183 534 270 242 564 75 820 298 348 987 565 456 970 478 842 895 929 182 8 443 183 776 533 925 315 961 768 74 817 700 599 174 67 782 624 606 606 577 10 563 669 225 176 172 134 877 552 933 149 323 697 653 834 502 509 850 899 914 470 379 944 924 479 80 553 780 3…
Output: 1570483

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Woven segments of Tarun - MEDIUM Coding Problem | CodeTikki