CT31141

The Calm Window of Thornveld

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

It is audit day at the acacia flats of Thornveld. Ysolde spreads the stretches records across the table and picks up a sharp pencil. 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 <= 3049; 1 <= a[i] <= 1000.

Example 1:

Input: 860 857 13 717 624 724 744 815 138 49 901 372 702 531 517 295 422 904 274 489 993 175 287 564 866 932 62 897 318 686 997 151 469 189 238 173 644 675 813 787 75 858 850 820 900 698 160 527 382 784 24 63 948 727 941 642 827 854 974 554 578 419 99 511 431 657 239 392 602 212 170 223 875 620 596 705 815 430 449 760 871 793 304 724 565 448 227 310 308 76 336 233 37 237 14 956 828 605 906 35 455 530 996 979 254 288 463 895 270 764 369 285 58 481 586 75 853 158 872 167 190 606 679 922 435 971 851 719 183 372 465 224 269 697 281 258 921 560 275 732 290 292 312 990 79 152 326 900 927 496 952 586 87 302 733 975 183 974 644 858 120 581 389 700 984 961 957 422 431 63 59 928 552 161 352 401 51 769 365 883 686 194 824 640 270 177 974 942 488 752 133 490 37 837 385 290 43 546 536 325 924 366 494 142 248 …
Output: 438972

Example 2:

Input: 429 67 515 804 57 909 385 401 691 562 752 109 959 28 150 585 857 445 669 38 437 127 111 943 503 205 114 839 270 918 432 293 287 160 62 292 586 466 90 655 199 31 571 865 150 341 611 880 154 871 259 978 169 802 389 777 909 342 594 349 114 937 827 843 223 582 417 814 206 122 48 446 19 724 667 221 253 418 375 469 5 294 656 148 997 23 680 581 755 909 395 857 703 1000 209 532 342 206 657 149 783 47 803 517 273 168 349 389 864 303 547 293 557 603 766 540 318 395 578 109 733 335 576 235 389 784 554 478 536 146 478 307 137 18 765 73 772 292 560 918 243 612 320 146 432 189 153 15 660 528 483 726 235 939 859 415 298 617 980 972 154 665 278 185 644 770 577 789 247 767 43 806 415 442 478 159 727 359 716 446 140 570 968 242 186 827 295 817 997 741 732 127 24 68 50 484 389 496 510 32 591 17 556 608 654 2…
Output: 28917

Example 3:

Input: 2167 1521 981 826 184 186 988 640 339 248 706 817 920 843 815 180 303 501 166 208 536 467 791 269 620 262 40 258 745 798 595 983 786 604 445 235 32 985 652 537 572 650 462 571 622 779 655 137 825 665 481 729 788 519 678 210 164 830 966 308 475 505 307 959 10 631 115 503 849 905 676 270 671 788 261 46 170 833 913 156 969 260 846 990 59 543 922 538 3 652 720 599 86 506 915 661 727 25 167 904 898 657 323 211 346 982 2 930 732 524 373 212 573 239 630 430 224 763 556 248 691 594 761 993 4 72 546 691 712 481 248 626 68 123 925 337 66 465 959 959 153 169 152 694 785 828 498 954 389 274 253 719 239 163 628 604 109 931 867 588 906 125 97 484 956 142 921 910 551 830 333 377 602 883 647 225 118 40 959 249 138 47 119 835 849 644 532 343 994 47 57 652 422 860 349 68 268 220 655 942 543 713 204 3 263 78…
Output: 743284

Constraints:

1 <= k <= n <= 3049; 1 <= a[i] <= 1000.

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