CT45781

Nina and the Dusky ribbons

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Nina found an old ledger of ribbons in the greenhouse attic at the coral atoll of Pearldeep. The margin notes pose a precise question. 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 <= 1236; 0 <= a[i] <= 1000000000.

Example 1:

Input: 1015 401 312833310 682763575 582067413 399926326 122591376 558644603 190583042 432204262 990492554 289155426 875394785 951474055 313718888 324843336 204827796 92380239 844959524 8010543 94882099 199271644 380114509 871940482 558943660 350298629 866566735 947313950 577090632 997695952 12759853 666089058 114042744 172195929 542560761 453607135 632960799 129910008 675566542 8812655 943432244 637470431 366948236 744738471 697082174 83981060 40904541 781076588 243729632 451593249 878410915 774199958 793798622 833033451 481933703 810205909 556592915 724450209 104266725 56974269 524680737 692482848 399145535 347765507 186607417 327585253 103063585 633188059 826627989 562665098 359743184 609315471 835715684 725810052 881790135 203122928 858699148 630088086 550978543 460040908 722217235 391956727 5…
Output: 191011205964

Example 2:

Input: 437 113 899731288 156110476 898583722 577009739 30728631 667579509 102455857 91594518 245639069 551211911 207618320 117616726 125897756 150677444 333193736 367572526 925212889 289330378 588345478 528209707 660966150 741606351 749693388 699461591 162433144 527902473 912969400 576171553 990672783 349730444 112339238 321096638 387644813 131142085 736024422 793077985 945050807 683110308 724880764 308795954 141504043 236127226 673941041 245895508 829045421 770223658 526714194 639630948 248010032 827816006 303122748 696202802 441728191 759516031 558001434 545509919 160846247 766974398 806451034 891267740 481192526 973385667 346230976 876582703 452201065 484904243 606114179 705720925 603532294 901774418 355757772 35366676 260031422 925175165 920767680 805121373 148697883 54241909 186628140 160946…
Output: 49484588694

Example 3:

Input: 812 546 433685465 74331901 113577682 992779890 532789964 181362891 777976247 449200673 720745865 971349913 963305549 579767493 541482431 632349204 805569900 61079269 602800864 77042182 530024475 821522379 825759967 357934106 670830818 679137601 997396418 514632458 523559421 856565785 77925247 360255461 727512284 851807076 252961917 171903053 590257010 703204545 502180108 352722426 77777238 455268948 864279036 937341813 990045843 509348373 776045343 668897390 95160608 488506808 458923065 180882219 966720541 499516844 46678189 986018325 23443066 310299326 129922876 523599235 661890169 680870761 168051442 16813946 943001024 581369117 517839810 830241139 816166611 592892833 169428523 346034446 576329188 816440343 700326325 372277523 30693820 654777259 952296408 584600285 730735108 779273287 33…
Output: 278224062418

Constraints:

1 <= k <= n <= 1236; 0 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
Nina and the Dusky ribbons - MEDIUM Coding Problem | CodeTikki