CT52177

Quiet scrolls Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the old quarter of Brasshaven close for winter, Quin must finish the scrolls ledger - one figure at a time. 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 <= 2994; 0 <= a[i] <= 1000000.

Example 1:

Input: 1668 1108 141434 322510 16706 51642 588646 895369 263925 336218 940559 559759 773005 617547 372184 271298 887976 87491 877661 57148 236305 476776 357305 179177 514475 216321 82477 594810 926542 214309 417392 175069 661877 445606 698118 671585 917207 730438 409021 629495 161521 967509 33901 585161 562331 617199 218894 159369 686847 135419 78027 780587 130437 880821 256065 928303 893481 149926 290904 273770 320105 71760 763683 477156 416218 480231 156908 11571 295219 504686 650883 496067 426196 2526 53962 44414 550969 718014 266618 453024 942428 403112 800527 693355 941643 847071 685424 616350 667252 752127 505684 73951 917510 741767 352657 127905 333616 724781 408873 323640 665728 409697 587653 955644 127150 780446 765098 696760 491489 227336 153825 392866 769039 526219 521076 363636 76238 …
Output: 534019032

Example 2:

Input: 2300 1037 476333 620287 983010 766111 474273 360673 916630 176131 112429 242029 56851 308497 888233 347190 387284 947998 275446 323881 827764 62825 810856 289188 50564 289259 209578 623896 48925 65755 155343 429027 757309 719642 310565 975258 821339 365281 951121 168229 30413 807770 113286 640968 294524 147167 673050 873441 546298 765272 255655 67796 619057 51418 417179 298973 531380 646403 322550 704336 534739 512467 595905 946873 428232 646476 113388 361470 823755 78320 189308 34221 566029 885231 849614 739578 326979 423467 730233 957818 795197 754001 901941 945954 667747 600281 944725 629102 79351 228622 361600 935593 342107 166162 821103 269870 944624 217678 664654 101351 167378 846772 105509 510803 772049 431839 919042 86327 947021 719368 428968 597694 118991 652674 41257 119136 20857…
Output: 499300376

Example 3:

Input: 2971 2326 331019 510511 990445 505523 493142 362637 254070 279736 659370 890882 135187 132052 11037 348694 347853 981239 571354 683308 358450 189879 325402 985750 483917 195126 129771 428118 604136 333199 946218 17374 547329 592992 928711 269835 68898 888374 462801 160638 873215 485379 578190 125446 855720 245382 759936 781931 597866 282875 412624 150574 740043 852851 988046 360968 101050 719918 660553 81906 838850 664300 510842 695843 47178 864170 305289 315186 385487 119954 317201 528521 643212 522542 85708 467408 17693 354726 253450 118678 113003 710222 871335 475067 253457 25756 894395 145577 984716 938059 259311 379308 453845 531615 521456 820714 432426 985303 11595 77446 404817 778830 811416 704668 353315 639359 569551 733176 846190 290883 140997 280519 734527 834286 702716 105380 62…
Output: 1176529613

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Quiet scrolls Calm Window - MEDIUM Coding Problem | CodeTikki