CT30829

The Calm Window Beneath Blackglass

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

In the obsidian flows of Blackglass, Lothar the accountant keeps careful count of the scrolls. Forecast next month's demand, 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 <= 1147; 1 <= a[i] <= 1000.

Example 1:

Input: 70 23 264 676 669 383 260 32 757 737 773 15 279 60 767 927 294 431 129 236 993 120 990 235 468 241 519 458 530 510 223 90 970 607 73 688 751 190 142 668 302 140 959 690 98 141 43 838 499 515 909 671 918 678 590 159 719 844 166 76 208 81 609 217 509 179 433 26 709 547 463 424
Output: 9501

Example 2:

Input: 1064 78 122 250 292 300 652 302 627 570 440 753 374 129 496 714 575 636 852 486 299 407 927 36 495 588 999 701 731 990 720 118 385 541 87 331 91 246 306 163 197 473 530 619 709 685 831 601 976 369 187 313 347 203 395 450 197 653 721 587 159 312 592 740 476 950 899 586 590 660 707 40 880 265 589 897 234 650 536 747 522 588 68 180 484 49 595 821 239 126 242 581 158 944 362 695 156 778 429 841 913 519 312 64 521 940 698 650 753 246 155 814 203 575 846 771 6 590 907 393 809 646 870 382 970 87 413 484 835 100 822 296 798 385 595 237 68 331 835 449 942 394 841 223 520 693 102 463 204 541 212 41 694 319 963 726 664 747 494 868 214 263 48 767 739 527 329 110 456 340 443 429 252 460 221 100 137 240 199 453 777 516 607 224 251 141 190 724 23 566 864 484 739 264 258 569 683 904 26 980 446 283 749 304…
Output: 33556

Example 3:

Input: 717 588 518 96 851 115 32 622 188 860 168 32 669 479 140 337 336 851 597 539 612 614 655 252 327 394 281 549 481 563 11 434 801 878 95 714 268 254 763 985 815 176 502 308 118 375 869 165 971 180 273 394 173 674 958 547 306 134 162 644 976 287 986 695 993 308 903 872 927 43 744 113 230 415 608 357 687 949 635 667 147 190 586 863 77 839 112 814 349 981 73 758 390 637 429 848 305 76 467 851 28 234 776 933 878 214 699 92 878 227 590 806 302 855 277 453 999 367 253 28 442 105 716 117 491 490 593 969 728 683 849 84 484 775 995 908 554 954 616 76 431 59 432 76 541 733 41 35 82 238 883 566 330 325 723 457 347 299 745 55 180 71 318 616 495 618 466 320 465 545 359 395 172 528 715 261 417 255 555 283 109 786 129 287 271 704 886 533 743 431 318 513 582 205 226 840 842 726 287 550 901 527 584 453 377 3…
Output: 278888

Constraints:

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

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