CT46204

Ishaan's stretches Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the moonlit lagoon of Selene opens only for a perfect tally of stretches. Ishaan 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 <= 1912; 1 <= a[i] <= 1000000.

Example 1:

Input: 405 385 360261 732317 710778 875425 756321 865545 559397 839177 23342 350604 464607 744867 685051 977631 711275 225451 80248 79809 588392 675896 875615 934704 74917 948619 143547 276687 390733 720581 833148 604448 780462 874827 158915 567418 713216 367442 643265 206803 329758 986013 634644 541140 677211 858049 585181 919736 647981 257034 99765 860088 710280 112287 925180 597809 294095 679337 737614 595488 250673 86950 65142 129829 687230 912806 491751 905580 131449 5076 412941 30770 716262 936964 854311 663461 598397 381515 913940 254041 869592 599982 217676 583052 827440 58372 305140 536135 872404 577431 826643 450540 820056 447197 972034 898695 480627 173481 938685 390364 43007 387588 236698 299050 511502 999070 828827 485065 216173 48839 260419 751483 73583 225886 476879 791394 779898 2…
Output: 200793962

Example 2:

Input: 247 153 931328 95864 907066 397713 257522 664347 723898 563044 715924 728704 999103 256241 483111 410097 780012 88742 710662 559830 897806 833632 52097 832493 625455 763237 92156 93797 387436 581026 694526 342026 434205 974482 895393 119380 734668 301450 492186 378323 584385 972821 640705 553868 498850 43074 506504 626192 668472 983674 787170 316869 511176 107910 77527 546946 983724 46466 782597 764474 697991 957526 938940 834046 695360 383481 719374 174482 236299 348820 597523 438907 218007 561873 815194 13830 896217 951940 133246 478140 942365 750738 872981 268746 845998 863593 279230 87182 407457 403167 672940 543218 305426 148915 281862 24363 596090 315775 306907 571708 106004 606116 790275 129890 116510 532570 792157 286216 803223 873135 969943 888220 338641 259674 964090 435649 11573…
Output: 75059800

Example 3:

Input: 160 82 109388 889160 806451 434988 161518 931497 207030 177355 498087 815478 583242 781035 220617 193949 483694 659303 178858 199236 730001 816205 480738 409052 509089 586547 489896 209972 752192 208183 723331 643548 39481 985094 517492 222157 929931 601388 924375 178823 474438 179460 273718 76133 259794 858571 169459 985030 535819 665673 932830 403491 946716 4513 961060 822384 89527 703575 95657 596020 516359 788696 429248 964283 493775 942685 861588 353064 749166 426133 750873 344791 512299 862268 747603 528454 299474 678502 921557 946221 895379 524399 975514 554660 410102 2042 917931 850058 877961 298188 963994 432680 369298 525906 362583 558411 912355 159175 568206 909888 128058 131715 888410 80505 992267 401118 427379 360501 682127 293782 54083 623938 559159 496495 210932 464101 79849…
Output: 41925960

Constraints:

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

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