CT51725

Zigzag segments Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the lakeside town of Mirrormere close for winter, Nina must finish the segments ledger - one figure at a time. 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 <= 1724; 1 <= a[i] <= 1000000000.

Example 1:

Input: 47 9 848006089 165395564 928764361 113585731 250415958 298241049 675703309 942412159 688649262 287542702 660256985 982853411 909397507 241766803 591299726 674673929 877291006 91516801 9300286 586269971 287282128 729350303 843934443 418897573 293742104 574116520 564725650 419830620 580899566 85116079 982495066 388845456 81464866 524486357 321725993 774175748 686213032 607232900 980607642 823730532 740778101 113318660 150080518 820414286 174178387 86044924 485484926
Output: 3834410129

Example 2:

Input: 1677 440 363916547 860930531 989666843 814229201 678782856 292915574 106948429 262260342 909030944 438606609 651783184 151428794 57368706 979857254 656483309 638497061 896952 84288095 92647796 666784130 68312212 463931928 945056385 623649189 171814667 439506531 149840447 279605538 460110239 805112747 298792341 908140053 102142917 545521044 409132284 660574387 642103048 699257826 511465073 775288398 171109752 613352192 737602947 379379361 177498357 488256707 786940672 98853739 577965836 430420895 94953656 950643881 299826066 413104187 201781605 450129433 869039080 510282680 324485268 562207187 352542265 177790430 256158563 21142851 222810230 448723803 74637642 364066116 378862586 188054031 327079872 694128434 421114040 26350322 320406995 291009255 630360265 164514471 781302392 797344455 862…
Output: 210182829956

Example 3:

Input: 1586 1438 150214261 502655281 301367076 120015259 218089511 5377180 534758023 526531814 99514617 367419278 628648605 870956144 101232626 87452931 487005543 674065685 753133401 979242433 242442360 114059770 513970123 15117819 584365863 766234178 814978050 63088879 133154825 560801657 196567574 411981971 738360008 934237248 343801282 92086725 841442370 457282191 826968301 60024783 481843592 560819925 887497412 610882605 372696476 796370339 82396523 625134362 243690322 916111235 930466234 47485156 60062014 23069936 484392428 557878510 637963338 507754126 898972774 42371928 996953033 788849419 434233076 784558313 490695532 725382683 370395620 484118261 816112506 360789765 28772757 917065728 947024749 153918214 384037152 407490799 214646472 670880611 758727913 964043707 450221393 306714138 8762…
Output: 716297977901

Constraints:

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

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