CT56786

The Secret segments of Ysolde

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the herring shoals of Silverfin, Ysolde records each segments in a worn leather ledger. The guild wants answers, not guesses. 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 <= 1972; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1427 255 696588699 494585090 461890262 447373674 751708529 301598112 830928832 353998672 621763459 617629287 25920398 627205482 90451946 758656080 106827139 738167047 647070055 704444125 340059049 578509568 852176930 941594805 137037445 280364948 939336505 754172149 390310277 789498562 592836130 988494714 428295316 905638650 793098835 885303016 470784312 906776917 205933567 60220824 112912454 815538641 404241752 511022851 229779637 303579717 496670711 769077675 234787432 742162148 329122390 194638392 447061204 736529325 451978544 654953675 690366278 22615931 288515468 437362625 886277526 378494678 94794455 483043333 586676864 40137647 846887135 549261294 585848718 524909025 139814333 51307128 371210334 31889760 377048640 772958465 966389469 398362120 267725181 511225184 295389773 639969533…
Output: 118114657686

Example 2:

Input: 1278 790 255952990 276609989 883976356 897724842 910025106 411958450 144118335 520882828 205383941 779840689 712875966 659981767 672283206 558513160 375726046 987134475 306348826 755543303 173861366 396963047 273838525 39896327 598943690 694271527 290523822 293883590 641826422 991585233 14678166 5745128 715109468 677986749 816058923 5688041 983411139 358773191 981335604 741432278 992234404 465704379 568116504 802827357 907399897 683353119 467900293 485824072 194898975 778761933 49543603 408617423 647062064 814640117 607345610 738480643 298860272 786824073 797814439 743319856 861320532 732418908 649743916 995839469 622404025 936915902 414472823 662657686 132592601 60313646 787918064 946591058 793570625 584085852 184646845 895190570 420042804 698002327 512376740 969642770 463144118 822815274…
Output: 397773782303

Example 3:

Input: 1366 257 558233481 903136026 954560759 540214433 747174785 898379633 42898248 747923568 258995217 117336149 913688135 502565443 956868385 919926276 338641155 853054833 823398311 387953561 444353854 920711539 931649130 745551641 426302009 18838553 405579235 697127419 834136437 780986777 325091447 705367839 475982685 364131442 381362910 846281261 270103804 283832757 525699841 309563692 778937330 975625522 672716299 626816739 276045752 443957579 734408113 156930484 728356193 446968448 490116347 310593492 273626900 17374066 1245308 381307888 932228784 226231197 422444976 478696588 40448203 241460202 395589799 729923932 309145720 640611632 573042469 341409865 703388736 360667565 275261451 718288457 21664337 40510860 470591076 135298462 732153084 127944664 793088908 637874282 203251117 111662262…
Output: 117804844493

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Secret segments of Ysolde - MEDIUM Coding Problem | CodeTikki