CT48464

Shepherd's stretches Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Shepherd runs the fish market at the ivory gates of Alabast. Today the books show a list of stretches, and the numbers must be worked out before sundown. 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 <= 2056; 0 <= a[i] <= 1000000.

Example 1:

Input: 1827 1304 252060 475780 54584 833748 373850 594458 209406 356409 982877 422286 451585 698686 546753 543010 506833 386361 599660 744973 740306 837427 35186 468187 959153 305944 155870 859340 441364 241230 167180 354367 172723 378103 74462 867052 160026 801540 152798 718506 423490 825259 755237 633374 717082 335550 68607 496049 204244 303380 383269 759942 76455 570929 334807 692157 760328 506880 958844 230180 967276 534419 597757 659643 16766 994430 406199 919023 439907 666616 707957 207952 956457 346267 655824 581231 254548 50342 416131 522902 209270 554427 676214 634101 785340 465067 439033 694845 257893 92642 70390 829200 129395 449145 988510 11776 629188 344588 645903 126536 285442 380685 875474 427684 723486 553094 399002 98431 258263 52353 996712 582222 309859 207315 428090 191773 9075…
Output: 634748622

Example 2:

Input: 1698 177 565846 822051 953681 903760 9086 300225 865983 324133 93240 880768 610150 911103 495250 38504 469962 41221 889882 287528 263391 687372 385792 819217 244975 70411 101133 228138 235756 204251 739780 171070 781557 557797 137437 431202 824324 289127 405334 854588 188441 681452 409543 334335 205799 34088 786031 572143 188533 141067 612732 905970 529542 174042 259176 825774 730537 667353 171016 996728 393667 435728 20524 815836 814257 480277 419252 654569 649226 266657 545978 586142 756208 972852 674313 163080 173711 673733 335364 398203 277423 973353 795823 653984 848707 2000 755782 537047 767691 567557 290722 244529 775770 244588 51723 912308 505975 82877 912751 163403 870803 57642 805699 830616 588900 755843 409533 175978 994123 754896 833944 680628 48607 46772 793372 827824 738220 7…
Output: 78723836

Example 3:

Input: 443 90 11607 467314 87376 418956 193950 806830 620735 209156 473449 94823 434791 58982 413215 284143 826179 956850 471630 199430 942999 896231 339447 857636 207455 533805 494225 38893 704946 913584 328067 704217 151110 216451 420371 97321 864029 616532 96853 14962 717662 838852 771370 13316 599805 107390 134945 212178 729338 802348 702613 213210 704701 165096 263835 612589 506225 360094 364021 832393 876805 837202 577353 874262 5198 296568 259277 97774 36360 517404 750301 486857 466039 321613 144143 325202 890198 449557 999752 957232 812084 931863 564573 770827 565714 781723 349842 479601 520919 738768 492999 900229 359047 830892 521636 574618 859769 180971 61433 2048 20117 921726 423481 598302 196793 899990 907250 734544 341915 70301 644997 631999 123415 564613 925991 618850 221804 455494…
Output: 42738632

Constraints:

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

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