CT33542

The Calm Window at Vineward

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Tara the tallyman watches over the ivy courts of Vineward's stores of windows. A careful computation stands between order and chaos. 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 <= 1404; 0 <= a[i] <= 1000000000.

Example 1:

Input: 59 42 835665627 418177071 526731908 651127710 816194460 452532910 515779448 653493490 788644035 753034709 873447298 484542014 292360705 944366389 97634852 270232770 130311715 792227684 878077109 746218464 106317107 975894266 856247745 865945729 560849692 34157442 48173923 710518935 151470373 801348889 901338025 2214732 538817292 799136044 694536463 642972525 722679960 115791889 463015257 656633228 173910322 500201140 823737247 467250368 639485221 479419352 996114980 533829269 501617886 64493056 945663991 190403490 446042119 816134978 195243285 339908307 64860596 802347140 126772632
Output: 21643442865

Example 2:

Input: 169 150 736339497 241130686 238915151 483011305 835010590 793292235 619149433 519227238 715877106 302467839 733496327 377312274 918406698 55146018 924109449 29446878 655976792 882089764 852920355 440073806 645303640 123996043 298800480 776112907 95998620 991634443 600867708 265071742 81364109 536781939 497631563 610965484 773834502 104279209 797521569 156574690 556788874 475238495 18329762 212843690 159534198 248685162 544856663 709738487 473203610 881081182 328989294 377716578 133008979 883727253 936269889 121177126 598404285 499051882 172902984 788434274 738201679 432646725 341579937 737055680 223679731 693566833 666156309 703083364 617552625 868556526 140175134 859605289 909283907 743728360 856898314 879052887 585145280 437261769 164346822 862998141 997227508 404637516 762603985 6364076…
Output: 79844729574

Example 3:

Input: 551 157 8083383 493184058 842869329 415606675 905689082 604293475 302654263 510826051 187843179 70038893 362351807 375769741 241618709 76716732 316150526 215718787 713352476 682445952 5407415 536941039 73279492 471344327 657673044 524340538 21048848 755453744 748635197 285314521 896718508 319495266 610669747 161087867 543891024 915968449 636052891 195036855 933120186 933856662 909161446 476066380 743454806 756090531 35824196 742769589 626147284 519273893 729740271 419304523 682949305 296915512 626237441 171868012 925465066 828299685 658084656 419794461 328041676 178720429 103135236 637931231 795429258 318500459 713051532 833516196 980545502 796088599 935786944 973805247 50434401 932396611 62749777 492729730 689103960 865854468 610641419 740447945 58735242 46724091 306985551 233453584 48730…
Output: 69719476674

Constraints:

1 <= k <= n <= 1404; 0 <= a[i] <= 1000000000.

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