CT36229

The Calm Window at Whitewick

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the cotton rows of Whitewick, Tanner records each panels in a worn leather ledger. The guild wants answers, not guesses. 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 <= 3464; 0 <= a[i] <= 1000000.

Example 1:

Input: 2286 865 952639 47386 269361 443127 896222 282628 854796 434938 573579 107721 764908 641801 328531 254598 164694 758693 866205 697982 199441 816908 685245 492290 447528 346934 969687 545381 150765 169633 454688 944701 596691 599776 568278 910596 901537 524678 703509 162358 207391 568861 246918 248051 671425 614377 3985 750373 214901 714991 731444 274409 124326 252728 602851 23452 837832 469774 973760 822298 27601 817907 38817 307647 31244 503161 447765 809831 719691 236747 837201 424021 896070 835960 99355 332420 381696 205996 804368 301982 750776 622757 317105 428458 440106 457603 777527 694849 63839 690835 323670 527577 630985 64916 453648 915623 233526 73762 543511 651437 927964 459115 507517 21850 76557 874298 810892 537116 180501 676687 510578 145666 678188 260129 115225 912226 831168…
Output: 422749526

Example 2:

Input: 467 105 470306 196429 82096 553494 28261 193054 424924 859976 203008 146276 873275 250975 293011 203574 991920 886959 552397 917377 576610 365385 333801 413367 204097 146700 853794 164440 378645 539943 184744 738767 75395 543737 755424 919963 993224 417794 891579 932467 754978 938684 874143 615516 690553 423033 553131 137687 179172 252797 552870 53306 693992 736231 369278 414493 202796 88827 947119 551646 459060 876786 976313 227687 435843 231973 813229 136698 516233 487588 473397 784062 59580 997726 721328 918291 253947 687848 174626 28883 242241 555386 604025 557357 727093 174456 91926 425238 672705 992115 7806 252463 243307 407229 506957 322902 803068 550510 46507 994456 612248 717507 789540 384664 862963 257113 380772 260954 515228 898562 793384 649003 525836 977207 67515 384226 196576…
Output: 45684369

Example 3:

Input: 3461 1057 414725 474517 702299 521964 480662 841397 700379 463799 35631 964375 792537 105839 34172 12963 279023 615178 663925 117305 688496 404376 270759 230770 234651 991346 798647 440047 319573 981179 567688 160668 671353 788836 295689 20006 253749 261141 467890 334463 515039 913358 563744 23025 259359 1281 354595 477294 741903 652173 646434 821672 333814 501679 30728 849910 498721 215516 753214 966059 412384 405929 317750 597682 751159 737502 163041 740241 867380 646823 939111 39985 211204 370649 728620 456033 669055 666034 958140 31461 309964 892494 229095 488894 275476 49853 549453 502083 242269 251070 832118 919452 686332 537375 665096 343924 836304 289751 471848 710384 486750 355631 433141 150544 920103 108787 43729 161964 265884 335593 443540 651436 713632 705413 774452 304339 3999…
Output: 513605246

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Calm Window at Whitewick - MEDIUM Coding Problem | CodeTikki