CT31248

Brevin's Northern Ledger

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Morning light hits the ember mines of Cindercrag as Brevin unrolls the day's manifest of segments. The tally will decide the next shipment. 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 <= 2738; 1 <= a[i] <= 1000000000.

Example 1:

Input: 497 208 754627587 906724470 122127985 882848848 882115871 697336085 145131631 632416044 706399165 201142124 231720343 658176789 778523969 804263108 983609910 889919050 327705710 393846716 272016104 192251331 902191403 674572572 467491768 683031632 746808693 322219237 76798363 150164277 770091226 640301943 530322499 63628893 954737572 704667431 613385347 409590812 676927887 543476467 193838014 194212576 757739643 701662241 335700045 283123529 830604730 522812146 662851674 68927524 891175280 461722515 863410466 809473378 583222857 817968806 192314691 377134306 735321463 774717587 765413378 647071262 936538608 196346545 978814458 230856038 371541111 939784940 33930443 11594372 454957767 169444687 239314900 710959283 889810372 456073353 789824660 83012729 758274806 690534212 99777127 39977271 …
Output: 97152967801

Example 2:

Input: 1505 458 216890183 999072060 470322535 129229406 610072860 604805377 917945309 94650520 578283477 864199017 64673388 680220909 530633977 42280116 431821766 572505459 792883252 926912653 210983678 648972351 205830617 603348022 933817399 25203415 860602629 320569727 729970209 991240229 7761453 733592893 585881858 265458584 179892010 885206000 32728869 619801504 791676516 978925144 768631955 125749066 919470149 598898063 859612015 742377866 650510607 733787768 174620908 869747038 482575962 826461569 638161616 427695499 585476979 468382748 305189924 82754421 477174503 662965028 438704842 971588792 585269352 956016318 694718419 572988781 512202270 410173333 485093498 244460509 360804564 123127146 302443155 404456408 927590606 101334063 123758950 737851507 358805883 569298893 756319507 757148469…
Output: 223168310192

Example 3:

Input: 2055 1030 867816152 849690537 982568188 500034690 697116171 592511210 290172902 632819399 229527104 850125552 611993580 781107110 933024522 198712183 530754101 890419914 429735215 781471251 819271440 13849149 80173656 200004192 657072537 805397808 798666533 186936188 63659443 980072501 733689063 142206882 586583692 10135458 567920398 88956283 700750016 655933966 543602348 287189766 258794289 539665130 473030125 937085874 482739957 797511901 731240340 72265506 568594517 401192500 144345481 935284408 530488086 438479127 329336144 439698406 542557761 528655219 197600725 879913359 566440519 800865962 964799183 168176347 255717431 570934196 111525658 754068098 706224706 817638386 246715302 656001443 257519375 558899868 157476755 220167238 765914368 577973081 801730326 485308034 8399218 99162546…
Output: 513102018923

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Brevin's Northern Ledger - MEDIUM Coding Problem | CodeTikki