CT46884

The Caramel Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the seal rocks of Barking Cove, someone must certify the cargo before shipping. This year the task falls to Innkeeper, armed only with the ribbons register. 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 <= 3844; 0 <= a[i] <= 1000.

Example 1:

Input: 195 181 910 764 640 75 930 268 420 575 699 758 296 612 682 758 105 59 507 799 557 666 511 156 404 549 835 701 965 837 589 692 992 516 517 953 999 419 662 384 780 529 347 389 963 785 228 670 307 459 44 444 99 833 605 901 609 195 820 873 189 271 105 265 695 537 273 487 173 801 588 665 84 152 679 302 988 787 549 690 988 340 743 16 647 313 792 428 50 474 599 408 558 200 880 145 179 338 514 330 389 251 409 337 826 541 413 853 808 631 878 374 922 265 8 306 650 312 459 794 921 22 351 664 627 581 492 345 225 303 70 323 852 101 94 832 120 435 110 643 338 239 44 175 366 159 856 848 294 491 468 800 647 368 41 142 902 999 902 471 495 784 545 567 889 897 995 560 62 859 690 958 310 539 808 544 981 523 586 604 151 86 788 598 63 997 712 708 631 481 594 229 794 658 677 58 762
Output: 93158

Example 2:

Input: 1537 47 327 353 226 896 702 239 788 667 748 450 547 365 857 264 141 594 481 490 983 100 946 142 325 314 249 946 322 612 458 78 218 418 882 654 656 928 662 849 359 48 657 321 112 622 711 731 592 460 837 767 915 721 865 834 445 580 695 972 868 537 851 470 788 112 938 877 773 436 448 636 110 300 724 910 881 618 761 724 860 321 124 921 414 679 459 356 400 371 54 148 947 993 830 939 662 981 832 309 943 282 613 890 679 372 992 571 639 678 3 737 278 862 201 216 290 66 130 185 70 736 457 931 872 115 607 366 299 946 856 869 952 287 291 127 413 820 877 827 489 647 442 331 44 593 807 965 674 130 8 139 604 742 162 739 425 846 654 128 348 772 402 556 900 498 855 629 894 594 70 43 129 824 289 727 831 380 293 702 923 745 921 514 968 301 688 874 851 840 359 12 238 25 921 654 842 343 212 607 926 997 430 45…
Output: 16821

Example 3:

Input: 2273 681 2 663 510 22 876 923 407 617 602 98 289 397 630 11 110 338 774 37 24 689 779 630 294 48 397 469 200 607 318 630 535 580 820 524 893 100 863 24 862 241 580 209 629 904 957 148 646 723 796 222 545 963 469 55 524 456 690 687 281 268 448 281 374 959 531 181 660 363 836 479 819 184 842 779 987 67 16 21 869 456 233 251 942 609 457 999 107 884 451 447 653 778 948 344 232 171 747 468 129 896 729 813 464 54 530 951 638 741 29 32 421 776 556 66 364 463 240 311 824 194 616 811 618 578 516 861 85 117 727 2 524 281 641 284 592 273 724 252 279 560 863 703 692 250 170 897 577 55 266 63 898 653 536 64 712 947 453 268 328 380 188 490 927 271 858 420 969 556 269 869 239 6 206 887 743 959 185 773 951 811 248 738 425 724 255 93 983 685 769 342 559 854 367 272 149 168 797 337 225 617 284 621 969 372 1…
Output: 323818

Constraints:

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

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