CT34832

The stretches at Greystone

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Sable inherited the workshop at the shale slopes of Greystone along with its curious bookkeeping system for stretches. Time to make sense of it. 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 <= 3182; 0 <= a[i] <= 1000000.

Example 1:

Input: 948 684 928741 933433 242892 490097 955146 9107 340390 3376 241195 997127 206383 975296 972668 378646 637021 863765 926164 87455 554212 443278 693628 1847 945510 162946 363460 610454 178362 199319 750567 667137 793421 794657 890996 89907 422554 312628 707179 744023 863344 836289 747566 324774 889715 681412 935201 218861 636024 663852 628763 688789 802752 600627 909743 453101 373821 391241 788620 374736 131130 642522 40629 765317 311359 343405 885773 392772 864998 724322 301840 181813 978442 274830 369376 177208 582555 405213 480733 619750 604195 592760 155587 597987 845087 6374 554833 825379 486805 370718 886821 318439 166133 492245 813662 774190 113815 716339 532829 991062 458171 653575 365106 770310 143305 23170 255798 912969 959252 259418 166536 260756 18661 100381 221989 881343 755108 …
Output: 320004842

Example 2:

Input: 537 327 883758 425248 757686 844309 318478 361508 702868 599644 939290 642831 305969 567722 525170 332809 727972 601259 675421 432878 578476 654575 170252 717920 500059 730859 534972 233839 49746 990622 419623 745906 745097 309095 853194 705010 156590 308579 690274 510944 630528 288768 83475 671344 529797 334359 11097 28672 19723 841485 858530 386097 361563 332810 285289 538866 302476 434310 548692 960395 117359 463209 669464 796793 397184 269398 593708 868307 288517 174909 597466 274520 499479 67402 519799 630203 949158 25380 255901 900195 236417 89896 163762 375783 110719 296528 937466 35390 44762 26254 416627 828958 14567 933053 204809 20902 909488 150278 482862 291461 672498 302364 687237 373024 80643 152389 755024 264221 344921 194825 936041 676414 706020 61790 135959 140878 647497 37…
Output: 154555475

Example 3:

Input: 2544 1082 77715 808796 781330 40414 942097 362356 379012 918437 886331 193409 526578 882085 794137 868721 363608 101872 309389 467948 462019 859164 430157 75472 239318 695057 115386 748387 314457 667387 550539 69631 963195 302566 151873 89869 424794 824452 198450 512030 448627 856137 571613 452543 218703 74355 584626 680307 504269 379138 968796 104436 954650 841763 703856 464411 138127 476444 598547 784744 523449 552494 506461 976909 69058 185481 651945 866931 664479 678173 8567 132672 841495 969192 139389 919506 729306 549832 828740 441854 418727 408753 106746 687756 124701 822026 980511 398128 587164 953214 123613 510946 808552 285038 588476 967773 184212 488879 516993 632794 182963 800697 863191 100654 79196 690771 411538 179662 760675 429677 756719 139476 757237 472154 716756 370311 77…
Output: 527362996

Constraints:

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

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