CT48600

Owen Counts the segments

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the observatory of Starfall, Owen the clerk keeps careful count of the segments. Track the breeding season, 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 <= 1368; 0 <= a[i] <= 1000.

Example 1:

Input: 197 192 795 918 925 658 245 565 960 95 791 806 242 818 22 287 145 232 214 627 569 518 294 545 788 695 457 660 947 795 552 304 64 134 550 333 983 238 263 123 194 17 39 845 368 158 602 399 814 829 651 408 636 623 751 609 607 975 678 154 957 14 902 842 251 559 235 330 651 647 211 504 116 673 807 474 155 876 666 529 733 851 972 503 184 595 305 907 72 121 323 237 694 395 729 403 614 878 665 703 810 986 533 662 834 99 629 594 832 257 316 785 284 517 379 425 527 322 747 39 508 263 477 799 924 366 2 797 114 190 310 406 541 510 892 500 475 78 576 881 87 283 897 978 956 826 438 891 443 988 717 137 903 794 397 106 391 776 559 640 304 20 393 185 326 550 683 523 407 68 331 139 198 996 898 283 68 60 280 800 667 800 780 690 176 330 31 930 322 442 82 653 305 827 17 578 753 40 711
Output: 95829

Example 2:

Input: 374 31 377 157 79 390 192 80 829 459 453 271 32 89 431 919 78 457 78 376 13 812 386 313 744 63 867 3 547 59 955 544 731 153 549 270 402 447 857 865 56 280 39 402 640 292 381 379 988 329 733 261 722 870 287 243 959 523 151 654 950 246 321 195 864 680 504 882 974 844 939 476 731 560 162 561 248 349 570 710 451 559 647 166 198 555 282 902 20 709 4 653 904 57 999 984 942 678 826 110 587 733 658 532 102 714 421 107 282 742 156 829 668 41 593 270 386 30 769 498 312 333 656 228 918 186 227 37 213 72 490 292 158 316 457 526 111 917 359 103 911 784 346 193 122 787 700 648 52 888 984 327 470 577 913 287 424 953 329 119 938 787 129 642 737 193 854 429 289 103 640 264 175 684 437 90 386 881 197 134 584 234 846 216 58 281 853 144 383 197 278 17 151 293 93 835 390 800 2 877 250 686 581 172 86 397 464 22…
Output: 10917

Example 3:

Input: 485 93 894 462 671 328 89 438 755 162 911 917 89 883 141 280 332 414 591 988 516 608 904 80 851 700 235 390 684 976 298 750 357 125 477 596 428 695 241 996 433 108 702 165 580 734 500 779 734 90 6 299 228 493 42 421 596 717 60 489 747 655 729 942 822 203 37 701 239 416 752 738 819 384 968 611 141 112 695 351 218 611 58 939 489 978 876 613 791 493 790 640 574 15 116 381 163 454 778 454 230 580 495 251 216 806 525 638 805 640 728 560 591 781 511 48 134 101 62 431 735 465 903 128 619 618 800 766 994 332 503 997 717 255 379 38 838 240 220 811 194 39 189 220 161 985 827 184 366 179 291 310 768 447 700 532 929 758 761 819 162 207 141 198 688 192 981 173 20 196 940 332 917 281 39 426 653 198 448 37 892 387 208 0 749 783 687 615 896 763 467 115 439 897 180 391 137 135 156 108 115 116 895 988 41 24…
Output: 38723

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Owen Counts the segments - MEDIUM Coding Problem | CodeTikki