CT36405

The Calm Window at Prismhaven

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the glass towers of Prismhaven, Tina studies rows of stretches entries. One clean number will settle the guild's oldest argument. 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 <= 2066; 0 <= a[i] <= 1000000.

Example 1:

Input: 723 421 800312 411087 778537 560894 290477 968218 574871 614100 523830 39254 999954 548928 538656 295333 926901 502121 670334 484797 686984 292310 409805 830015 998275 184673 954536 797463 514679 810544 650531 219693 767754 400369 920647 565785 111148 322580 289963 424292 223059 63375 266646 210976 815427 873364 873704 247219 713421 888488 232875 623583 893881 412788 421923 338904 301847 758796 934630 233029 494362 989514 824798 877880 938639 713745 891960 934475 227495 582548 472161 599430 629204 92013 950735 32746 216786 605213 582356 471363 303246 326935 620149 337957 239132 558331 219903 121638 568653 756052 452079 561009 693549 392552 592716 827229 131760 580979 498861 125414 957110 448492 576912 776689 487692 461859 801176 632837 87620 475465 264315 203819 417836 875638 893028 351880…
Output: 214882173

Example 2:

Input: 159 14 352582 279501 371483 899969 975630 916392 104292 638767 542696 801593 649011 208381 319944 829696 205658 295178 115029 415591 794863 749998 853666 854502 630402 733854 703146 270220 126 868439 848753 160493 833440 448168 258395 782110 316789 410550 493182 929499 964767 294378 355633 778258 476239 88528 877162 874682 836586 773902 780744 354754 64579 213309 796418 152693 386824 443556 772066 826632 484258 884521 851162 203797 205319 347497 168752 757694 352479 724018 676532 65792 495385 513688 186699 816908 614512 765600 249166 702366 804587 754364 386370 939173 708579 375130 262146 526496 84287 119330 709888 235162 837631 175091 68710 257228 86992 843720 465389 933738 516665 618933 234070 886806 243016 89391 866041 895834 262107 375392 710365 584394 823973 136635 672888 73480 765369…
Output: 5047200

Example 3:

Input: 353 124 90432 438075 476366 925302 546574 177137 334875 309541 890718 571853 21435 703637 316701 425691 684041 329819 400991 895209 705939 966325 80130 450608 536420 199474 369756 976867 280316 985232 616226 463277 90243 270721 586143 469009 541777 912925 289034 515543 181969 259714 196193 711294 428364 430744 997643 294878 153298 753962 930465 73487 612052 332101 233836 871156 809894 271579 43341 73103 384445 186512 848009 903212 106738 671922 953164 198442 320072 367328 924367 40569 419717 238531 539365 190865 526650 915267 861622 327224 516928 30620 486315 386240 966332 757429 74733 858856 261612 757681 734362 773 352644 253416 594736 643995 76407 42084 998905 188194 324325 18405 372585 21542 287863 128820 53223 30158 123613 850107 96189 305876 969383 244384 662279 215327 738082 544486 …
Output: 52654994

Constraints:

1 <= k <= n <= 2066; 0 <= a[i] <= 1000000.

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