CT44494

The scrolls at Crosswater

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the ferry landing of Crosswater, Devi the inventory keeper keeps careful count of the scrolls. assign crews to the morning shifts, every figure matters. 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 <= 2596; 1 <= a[i] <= 1000000.

Example 1:

Input: 644 364 471370 635314 516270 967104 833668 892315 702 241743 228391 363708 887021 38028 15039 162009 399840 248924 901259 722893 311764 10784 162515 476541 494859 767579 566850 368253 772755 178608 20427 46152 252698 202819 72230 331137 594009 994843 283372 271812 29142 116080 777136 762017 294288 753375 695469 768483 452857 4117 168508 795855 556851 38096 637102 751932 460120 241056 504779 375124 593852 148467 919314 680673 764096 820306 429649 795928 645717 296588 346810 497159 11981 306980 150318 709933 988429 971414 116536 90499 927477 477760 709558 291370 275638 559217 93337 553178 353095 115522 260299 449575 234012 190315 440462 141674 857012 630323 631960 211893 23417 333123 983186 470997 915918 245673 565128 460676 219863 947159 903473 402688 105934 515387 440598 266807 153608 8889…
Output: 177532127

Example 2:

Input: 884 369 978564 245176 814457 437441 109823 801880 558779 973748 221357 845419 14631 647844 700720 524716 222746 636661 765825 149141 989277 543536 389965 873428 465848 173862 674006 412684 308196 978143 49688 902306 785162 972037 171685 557054 840582 125349 681453 291070 71931 138243 855288 391559 34685 276351 808689 921418 342083 919499 694802 784839 731037 683663 742465 123751 472727 86774 868741 157397 326253 313187 288294 612834 254147 509234 781043 628326 484500 936291 973804 489233 371798 552770 457582 134784 662397 120799 737497 867902 433738 833606 114900 24281 261710 41562 92043 354059 512404 830143 736470 510464 463930 391981 277806 722348 474238 528611 56852 860233 511379 648992 672200 307461 178946 912552 839773 937674 191967 954127 928192 894491 446619 230144 742420 85145 3016…
Output: 176500716

Example 3:

Input: 1644 932 987077 846929 712030 431955 458840 877055 973759 135868 694793 649745 402862 492032 411863 452308 333287 426601 183540 125929 713731 479744 583028 141935 512719 625246 721323 951879 672347 56531 528775 436291 226968 361941 436156 199107 805108 110409 788268 45172 122463 443325 243322 935728 251279 575018 767394 420450 162606 66629 737415 935878 837350 164871 758799 170233 50105 214600 258688 722194 243698 997580 657090 345615 806134 538124 109949 564290 111034 688059 129371 423170 340062 455206 692059 34176 453759 10725 133511 839986 49429 569711 339720 547782 936689 416096 818358 239743 552915 387830 481356 830125 867752 933482 956201 259993 259720 608347 429513 703052 965112 233913 435449 410639 162237 90580 511672 680980 292605 314480 909382 414756 243719 83014 457363 61867 537…
Output: 449074999

Constraints:

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

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