CT34014

The scrolls Calm Window Puzzle

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Deep in the silver mines of Lodebarrow, Forester studies rows of scrolls entries. One clean number will settle the guild's oldest argument. 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 <= 1120; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 289 215 -630825 -68898 59697 -151098 842372 -378513 -302883 -745966 -63066 640674 490114 -940835 -883297 -566918 360912 -92181 777550 847124 166552 341696 509984 831527 -440940 -635501 -136397 526475 -537748 371626 -23572 -194741 411539 124638 -988232 -728554 609866 250980 -342606 521486 703110 -618955 761560 -672595 -632593 -150652 65825 77120 766176 -587468 319527 789839 532680 -722884 -849134 -769356 561473 344318 681741 864307 598783 987975 233397 95131 431824 -911910 405649 652553 -554568 157820 891070 219138 35342 873205 141940 295818 -624476 559774 -872430 -824752 -694917 -641957 -946313 -590844 -504199 -871845 -129902 -966287 647607 -1852 240702 -682394 632519 -921679 -851778 295982 447664 -958123 -347447 -587700 577315 -930755 -559909 -978343 554192 -162012 534340 -664682 -802134 …
Output: -7607315

Example 2:

Input: 728 370 -234543 17565 179961 -31154 -99289 -552565 937820 926339 -553848 -679234 -969929 8609 954610 416091 287763 55242 24523 -626622 242806 890168 -422976 666757 -20045 787283 -909476 -673600 666378 776196 -670320 790806 543704 -97052 198118 304214 -137615 643224 488964 982038 -96878 -142695 -950918 422506 499853 277671 -561370 -278676 147670 866390 -808288 516720 319515 -522204 -688411 273989 449946 -291092 375129 -79950 -540198 -423543 885315 -584845 481749 503756 906782 -416835 230603 -137860 94173 211257 529687 957987 707318 -730607 129039 679523 158001 949588 965485 -143692 814647 -210534 870937 181763 932600 -230736 681707 104907 861583 704615 -609169 -199290 416747 717952 634632 518702 -262796 23574 80610 -463092 -310480 -883809 -212416 748414 632093 983081 839352 428202 132106 -9…
Output: -25495607

Example 3:

Input: 741 274 541381 -132097 -444056 -908556 882375 -400774 -947623 380427 418233 536438 -951508 -616113 951623 -821957 632304 776885 406821 16228 -990346 -188810 237792 -642150 -736814 611402 184413 -292673 -112545 -824273 -390676 -674403 481777 -852234 -816067 -933153 -548908 871278 453266 304115 -531524 -661591 334930 471535 -234640 694971 -501391 193857 -186213 -847563 -282931 -314053 -411766 641764 2905 -187078 914266 -470210 684611 316274 -698568 298807 198192 501674 559902 253448 -95023 980683 -6317 -556719 359059 -155317 502728 -372698 -628857 -981835 284599 -206972 442031 -459320 -651485 524295 -987730 77782 -110432 -733035 2396 738118 -803292 -712382 -114800 -35232 -237927 -844511 -889689 111562 -539383 -894108 865097 523769 491325 870119 169494 -705145 -405108 -571593 153954 -618519 -…
Output: -10234747

Constraints:

1 <= k <= n <= 1120; -1000000 <= a[i] <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
The scrolls Calm Window Puzzle - MEDIUM Coding Problem | CodeTikki