CT30701

The Calm Window Beneath Sunspire

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

At the temple city of Sunspire, Sailor records each stretches 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 <= 1450; 1 <= a[i] <= 1000.

Example 1:

Input: 985 804 7 679 906 567 890 471 485 91 287 86 719 896 308 49 917 555 208 312 985 489 118 643 73 762 170 213 843 505 157 75 83 721 411 972 140 901 336 387 190 236 752 216 303 751 765 358 496 451 723 714 647 731 346 948 858 940 990 975 759 77 954 701 372 992 103 314 396 770 174 907 129 44 196 498 988 741 230 181 887 657 153 342 882 102 359 973 56 60 627 130 646 27 490 75 417 928 745 829 749 888 717 463 278 140 690 646 284 611 908 924 263 827 115 699 343 892 488 965 4 609 900 401 787 728 942 622 273 73 273 348 873 939 48 886 810 239 219 394 289 16 108 440 738 573 665 535 631 148 119 319 118 543 879 89 59 953 976 37 298 537 789 672 184 490 875 44 813 127 575 689 577 595 714 400 111 148 370 895 861 750 980 80 1 556 295 507 173 25 680 16 552 553 425 363 423 840 641 797 713 90 158 4 992 839 724 577…
Output: 396390

Example 2:

Input: 1312 543 748 252 227 274 505 550 188 98 484 256 205 554 483 70 844 26 472 840 297 914 292 969 338 702 391 831 854 266 662 453 998 160 495 45 940 331 388 171 30 893 396 297 396 267 819 890 644 198 850 79 123 643 305 625 924 354 218 663 641 16 355 143 860 505 193 112 512 47 105 858 155 336 308 887 577 855 10 962 167 921 242 980 290 544 769 5 379 748 803 249 296 937 41 754 347 656 296 540 200 771 528 907 931 825 182 953 860 661 239 567 232 410 448 717 216 818 337 956 383 804 633 277 808 338 842 437 500 62 516 455 538 712 172 540 467 196 205 837 740 110 81 83 927 296 265 675 706 448 876 507 281 340 879 477 811 153 525 617 684 755 390 941 512 253 274 41 474 886 417 555 564 770 936 520 451 896 833 442 685 180 353 770 878 832 943 927 416 788 792 824 160 339 958 8 778 857 460 636 494 7 176 267 552…
Output: 261630

Example 3:

Input: 655 413 971 455 578 345 278 771 353 273 771 424 619 703 865 265 1000 278 366 738 263 264 256 979 800 511 140 10 599 491 562 388 708 343 645 430 735 616 170 66 114 286 638 51 261 965 346 920 831 299 90 663 149 265 635 182 606 53 891 992 125 799 972 391 309 86 809 411 191 664 830 464 148 267 864 404 361 270 86 711 396 924 292 595 836 209 610 663 735 28 832 438 552 162 820 662 390 793 344 600 207 255 456 643 880 742 214 708 819 888 608 940 944 314 120 222 910 889 181 216 217 570 524 943 663 495 761 447 114 1 439 488 107 627 274 401 114 563 268 278 3 301 866 14 733 854 421 616 410 690 872 241 702 329 592 872 839 853 905 697 244 777 340 542 350 573 627 213 870 421 249 88 490 934 10 354 680 472 753 7 211 763 539 328 191 729 627 871 937 192 895 414 247 640 747 176 472 927 4 944 661 498 117 487 60…
Output: 196876

Constraints:

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

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