CT38519

The Crowhaven Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Boris runs the aviary at the rookery of Crowhaven. Today the books show a list of segments, 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 <= 2357; 1 <= a[i] <= 1000.

Example 1:

Input: 1091 937 107 757 149 629 412 99 775 327 515 726 2 71 121 488 404 411 322 601 693 441 479 685 127 149 80 685 658 547 194 857 68 570 335 649 863 850 116 206 328 485 189 925 553 166 446 865 731 645 104 622 483 532 111 647 411 781 517 551 826 785 813 736 104 549 217 553 467 955 612 627 453 31 922 16 490 649 125 517 697 725 966 776 102 738 865 197 407 221 172 954 831 261 683 156 931 470 624 191 996 291 951 394 948 247 321 99 852 402 44 70 886 638 897 702 88 403 862 950 242 929 597 3 234 464 910 171 577 718 46 734 215 491 967 119 979 371 511 370 463 499 104 476 57 836 291 850 996 84 239 776 685 206 459 633 321 434 872 639 388 559 368 833 648 992 418 90 806 792 484 325 100 365 747 509 296 244 811 803 785 622 444 847 16 589 214 829 286 20 258 287 906 92 14 551 96 55 726 170 911 326 514 595 694 702…
Output: 473295

Example 2:

Input: 1505 240 139 763 622 223 5 397 491 427 613 947 328 893 123 28 936 900 459 586 876 589 431 257 344 208 314 205 107 121 673 628 606 473 744 104 77 517 664 950 754 543 894 584 632 362 140 651 316 280 773 126 779 236 113 557 249 391 592 56 630 602 582 133 332 216 474 280 394 605 252 824 653 968 72 333 159 66 189 997 492 412 872 370 703 825 472 302 866 546 298 419 180 50 368 52 103 78 100 152 87 844 344 93 428 538 966 847 583 116 189 834 815 109 947 753 618 892 57 778 292 551 799 6 721 220 646 298 169 364 340 616 253 501 205 499 696 665 607 690 423 248 296 904 548 283 169 44 910 637 573 746 597 30 253 865 572 59 30 738 733 231 520 520 816 987 932 608 254 658 653 660 6 887 846 329 775 261 829 873 479 300 264 884 16 702 296 955 960 702 133 602 446 995 113 941 67 688 209 666 880 400 795 805 808 95…
Output: 108422

Example 3:

Input: 2119 1260 350 30 400 218 541 580 95 131 884 844 291 967 795 165 671 556 926 639 823 217 92 921 972 637 719 388 640 834 365 365 99 673 74 277 947 943 117 280 625 794 326 664 748 481 546 2 725 931 518 960 206 586 41 635 628 439 298 578 641 113 652 202 102 773 944 414 675 366 558 113 137 961 415 871 807 781 166 765 353 718 680 925 277 869 897 171 705 786 451 552 941 532 75 784 502 713 550 608 144 372 626 660 766 957 233 818 800 950 139 569 579 190 140 439 962 556 765 126 400 793 266 737 288 761 937 847 688 361 356 441 662 996 647 361 620 281 258 973 307 208 428 18 649 366 721 374 530 65 757 925 205 169 106 129 504 103 425 516 649 348 584 57 105 397 827 981 818 558 934 669 260 134 52 449 557 495 46 298 44 165 485 188 577 455 14 193 734 209 824 700 909 420 596 791 419 933 26 937 58 521 441 598 …
Output: 620212

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Crowhaven Calm Window - MEDIUM Coding Problem | CodeTikki