CT33757

Gita and the Calm Window

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Legend says the vault under the river town of Willowford opens only for a perfect tally of stretches. Gita means to find out. 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 <= 3242; 0 <= a[i] <= 1000.

Example 1:

Input: 2348 625 254 792 164 451 71 268 246 546 300 60 121 446 122 229 568 38 275 57 893 977 968 444 820 263 555 669 235 860 75 307 652 36 797 668 302 596 181 818 293 641 155 241 175 290 870 412 622 761 235 33 821 338 824 954 499 341 854 696 916 758 16 212 617 528 463 174 98 309 110 892 385 153 776 368 286 261 269 478 661 870 411 613 24 34 277 764 978 439 445 764 258 10 909 724 609 762 376 809 636 583 889 711 554 806 743 321 607 138 568 246 928 618 152 123 496 360 482 62 354 770 812 955 876 629 501 549 669 716 421 108 497 866 288 96 106 756 669 460 525 784 316 298 970 204 582 698 346 605 601 289 616 749 470 580 376 741 393 459 4 113 986 237 984 873 282 356 314 272 462 407 796 52 525 291 885 851 702 360 40 837 475 429 520 357 11 425 76 758 844 823 648 57 303 278 852 8 143 311 611 485 579 315 783 25…
Output: 305028

Example 2:

Input: 2853 1151 702 12 928 422 553 760 527 756 405 172 784 841 293 298 433 146 248 480 207 160 712 221 843 252 72 403 978 103 121 408 214 34 931 528 839 524 58 884 2 627 145 92 271 282 416 543 155 636 265 745 768 468 110 599 202 784 208 176 100 325 372 695 347 844 506 122 128 65 846 691 148 531 620 526 441 48 447 651 59 246 572 186 92 653 560 684 805 471 258 936 754 675 36 887 490 719 789 48 845 205 278 289 706 600 925 181 560 665 981 314 350 933 412 174 385 210 303 481 6 121 638 623 404 312 566 452 670 776 950 265 170 306 114 792 544 405 974 883 328 936 95 560 282 829 756 350 564 718 834 666 747 128 782 743 546 946 95 127 640 542 412 52 31 200 556 979 743 290 622 711 7 480 76 126 261 946 434 892 550 961 694 126 939 705 466 159 195 431 880 944 329 4 334 485 935 687 813 836 334 508 539 399 929 17…
Output: 546378

Example 3:

Input: 2381 725 545 467 215 42 736 207 971 533 696 491 600 785 69 492 936 458 848 607 369 300 903 814 619 436 230 647 751 667 102 246 236 240 736 10 139 245 518 3 280 222 484 801 284 711 625 923 827 219 823 732 467 729 921 795 881 487 955 656 460 283 305 688 198 828 912 343 496 468 313 941 578 40 901 876 211 171 230 53 259 936 637 42 758 716 535 478 644 462 79 939 341 721 851 808 661 881 381 949 16 356 156 511 818 918 535 644 668 296 296 679 180 776 186 128 501 622 540 635 922 630 220 84 193 112 288 280 158 606 675 379 529 224 444 820 1000 771 353 48 682 961 293 283 421 82 516 316 436 251 114 68 683 819 788 420 126 669 695 260 174 448 37 912 290 684 901 822 477 160 534 802 514 102 739 5 976 854 752 156 781 619 277 44 176 238 980 596 893 869 121 62 112 106 800 517 363 807 931 480 269 943 108 10 51…
Output: 351786

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Gita and the Calm Window - MEDIUM Coding Problem | CodeTikki