CT34434

The Nacre Bay Calm Window

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Opal inherited the chandlery at the pearl fisheries of Nacre Bay along with its curious bookkeeping system for scrolls. Time to make sense of it. 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 <= 1443; 0 <= a[i] <= 1000000.

Example 1:

Input: 1 1 356885
Output: 356885

Example 2:

Input: 256 46 676380 289323 964790 464937 11322 41386 313656 727242 844401 588040 748512 302592 724189 175950 121348 194800 794698 759871 39376 886033 635611 772091 437480 269607 710342 783031 419983 368293 151832 352457 465821 491023 92830 815523 868070 159014 591713 239318 841715 998729 968083 247841 923746 305186 790926 276555 278680 584404 665474 189463 433267 754075 324351 133660 210338 379116 712528 339197 842976 417120 439582 340052 675509 765236 424534 660154 892417 754648 793388 131438 900062 434776 446551 946818 595785 923707 977242 812368 614332 540052 68754 883396 312152 968080 65275 169564 878467 740772 973661 311516 44113 641891 256227 600573 353610 780112 243160 868214 236477 926630 592578 692022 365507 299948 540396 508307 45874 8831 228876 981959 106527 746119 566359 937049 50207…
Output: 19670496

Example 3:

Input: 1421 915 638322 184907 808918 334343 376648 420652 633511 159646 361660 673438 660238 746427 696384 456490 913752 897884 791364 965227 760412 273323 786775 522916 176731 494816 27946 600460 722925 706651 486061 515052 344835 610098 683915 339498 654692 762448 763658 764596 147358 799533 895011 106589 118336 608829 101183 803469 957301 696685 52372 169738 525822 98814 753694 303909 602663 593772 900456 115616 40223 207507 546053 373060 101108 572912 997646 146895 468391 218772 426063 983795 713026 924624 532005 429693 438374 631629 594521 656213 869504 30000 896668 313972 682990 109898 440360 328572 256677 480770 341115 320132 968142 403828 985164 690122 702548 127228 133025 710809 879661 286137 938098 544855 64108 912798 668556 440227 542447 488343 713191 562361 532322 190076 609473 966414…
Output: 456073501

Constraints:

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

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