CT56830

The Celestial Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Nina found an old ledger of scrolls in the shed attic at the ivory gates of Alabast. The margin notes pose a precise question. 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 <= 1864; 1 <= a[i] <= 1000000.

Example 1:

Input: 904 756 501762 63743 917995 169530 65538 663961 155897 278821 396335 187058 129185 675213 921903 139046 97254 621999 85973 680654 802731 967 101329 16239 361644 531758 160526 388939 123693 233534 806393 389083 818670 950936 414481 203734 743987 210233 817220 320677 374116 416532 249232 577260 144475 101677 817712 34173 701011 766024 9906 680430 7725 417186 149091 80653 990959 660000 754521 706858 584601 591202 735421 339146 705904 459153 898286 21236 718615 173780 125501 178872 223529 169769 891104 56411 440859 97694 439668 62458 941460 67825 207318 727976 40280 404354 372426 140624 228982 341806 6467 559388 169884 123076 791527 161270 320297 322185 451535 832280 396380 827684 930543 85856 634205 63224 11942 166024 473797 981766 774648 101720 927536 283624 908302 635675 8717 99563 758685 5…
Output: 370457648

Example 2:

Input: 110 39 71634 731568 905740 74525 529622 315103 923008 84319 484970 836744 71328 695774 9369 61169 384261 33736 681570 454913 45125 719747 507314 945469 830234 237090 899557 572547 772014 393173 408581 130866 992022 144635 921500 34397 521561 993154 671569 321808 151241 286592 78619 477423 323727 233346 764811 241956 374083 222183 424461 268770 350175 672687 375265 417643 986776 614538 302088 837459 509540 366576 607275 838035 203602 862475 637313 866896 744203 346061 835670 503940 570530 616925 978408 137880 913473 304168 985041 306988 535338 932749 614612 948840 48867 643741 513106 628837 145538 705529 963094 937763 28593 340267 120318 124855 103379 892728 19136 234318 88227 334051 588454 702802 221171 485588 838903 932875 821150 343992 155537 901048
Output: 16884768

Example 3:

Input: 290 119 763068 713105 19862 861438 838957 777872 400696 431552 600800 952000 151459 95380 893191 475423 719977 258185 628922 745103 480004 826970 659252 700227 674409 664652 629162 398473 553176 178068 827980 849149 806188 441871 105666 397055 998177 35184 242048 123369 992656 953019 804345 134921 151403 157085 738083 965937 685910 34818 160776 757543 234527 509925 754153 147467 149165 231140 128914 328376 38575 676495 157340 625674 674575 353394 411729 317032 164049 921338 875320 932172 267741 569131 452954 434068 533956 8597 866141 84714 924067 953521 269271 78244 412103 583853 275091 947797 583840 100850 551792 392261 210147 456847 354390 855607 91066 172256 962539 82533 685123 660478 489872 192308 43901 538698 65818 454561 532699 139929 661904 100623 228220 758152 83044 208053 289936 4…
Output: 52337569

Constraints:

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

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