CT41085

Hans's Celestial stretches

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The log keeper Hans has been asked to plan the beacon maintenance rota. On the desk lies a long table of stretches readings. 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 <= 1052; 0 <= a[i] <= 1000.

Example 1:

Input: 988 865 278 333 509 880 782 929 242 13 498 774 194 899 156 977 564 49 435 491 455 869 869 170 878 139 554 887 434 532 107 84 796 774 750 317 334 474 349 450 830 189 482 112 431 444 490 333 32 615 221 999 959 426 693 364 842 656 522 928 961 447 890 596 870 351 669 345 87 276 72 408 71 607 396 513 99 314 430 130 535 121 987 182 279 518 353 454 14 842 656 854 763 57 205 61 986 373 777 523 540 409 598 717 240 134 177 328 377 21 738 232 393 608 93 636 389 687 771 361 222 655 721 245 108 79 201 828 185 938 92 613 538 859 703 202 61 435 800 141 499 464 918 49 952 840 822 502 114 624 293 137 140 63 144 926 593 885 699 576 877 686 381 155 978 619 348 60 958 727 626 771 322 347 450 368 548 719 538 647 265 161 945 605 497 275 509 975 397 97 391 125 982 710 296 926 217 963 334 985 19 290 573 655 790 8…
Output: 416657

Example 2:

Input: 226 49 523 763 763 624 524 520 111 35 356 763 518 278 915 261 447 893 405 453 575 871 102 825 47 482 817 385 89 178 163 906 440 233 708 321 376 597 568 738 789 718 434 280 337 980 564 122 321 966 245 125 87 547 44 561 300 428 355 474 240 347 171 804 138 338 743 962 253 980 628 404 249 712 692 185 120 804 518 132 52 504 770 61 898 196 727 183 339 304 15 869 488 70 578 991 566 985 998 715 538 576 748 924 162 199 376 696 976 356 234 675 201 895 499 530 987 917 639 238 144 558 703 834 156 891 522 943 891 290 352 662 773 708 530 80 551 526 807 335 268 295 473 232 957 493 438 783 575 496 436 739 785 194 277 162 411 986 749 750 943 260 993 775 612 440 134 474 999 216 274 995 56 534 780 737 644 644 242 861 643 502 772 498 573 307 935 643 257 308 440 964 474 904 967 425 149 33 996 886 642 455 620 7…
Output: 20613

Example 3:

Input: 786 332 269 66 875 276 118 281 648 306 495 380 457 431 843 811 15 392 531 860 835 239 383 662 761 949 462 139 248 10 913 661 651 457 829 830 960 289 135 201 438 99 482 886 488 182 404 816 788 772 910 978 146 860 233 874 177 540 731 233 856 439 695 882 794 913 64 320 554 157 539 709 931 987 730 119 323 389 104 421 994 431 503 678 437 954 58 130 508 402 529 44 609 160 414 169 828 486 120 504 179 563 81 805 348 135 968 315 823 635 158 989 818 82 546 752 717 145 199 406 791 224 629 473 331 657 651 743 818 192 362 9 185 820 159 482 106 753 156 934 376 974 595 177 626 695 418 553 653 420 874 160 243 607 496 805 186 677 121 743 215 791 258 178 209 506 102 352 554 140 739 573 424 130 113 785 762 999 476 892 958 39 6 993 225 583 519 879 427 724 961 35 472 852 790 16 123 548 616 720 144 791 823 617 …
Output: 149849

Constraints:

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

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