CT31944

Yuri's Celestial segments

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Yuri inherited the tannery at the clockwork quarter of Gearford along with its curious bookkeeping system for segments. Time to make sense of it. 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 <= 2677; 0 <= a[i] <= 1000000000.

Example 1:

Input: 1237 319 38205156 787150197 552458687 46742719 751969524 858521613 674664310 698725441 258043249 620391057 534151442 596763247 521527202 744787346 938175140 841961900 374394262 140297907 965767182 428723066 60053123 613794086 718416441 819191702 426418961 869381500 948844160 177282729 463437444 7936107 285856382 357322209 652304916 145201778 679849840 316827227 842352453 145568172 612670292 43632443 644300944 843099356 969195535 289180339 608552534 945297184 582137849 299755045 877205830 691950216 470933547 689250247 495301911 299635742 797887828 643298027 434723339 700184925 61540259 103642498 903578894 454629471 855676785 509772639 744308472 222375992 233405500 161331077 101083072 15514853 420409590 916576132 364025663 768996464 4634146 488910319 47068691 264919341 458956203 366745019 47…
Output: 156075372764

Example 2:

Input: 1040 773 168718760 976041145 312019245 159685756 78801432 812834758 303222097 959569505 998377008 596002292 219665591 694683733 3090402 817451499 429902763 966436981 241388722 961477459 858684952 247831287 470543915 692087865 171827530 627347756 864958542 70853659 680578112 293024594 711056040 457617253 693620442 632121907 990756508 623679306 677922488 45469923 513540909 893067955 104503606 473603871 687709065 178833479 37717746 33764478 873670303 492390664 814832097 619657818 4546811 919285732 415434329 939667089 88981887 657795803 175150719 90956842 446239373 123162004 469685694 922104919 984077308 564333337 57976384 813346166 89348280 825082976 581871319 501215650 889871505 83167483 818132399 196748784 608792318 36037542 2383 285970866 613072924 524888824 515012739 630530324 64326413 50…
Output: 385063047774

Example 3:

Input: 781 545 926245437 309365446 766271311 933281686 796188639 569736243 651206559 862593952 988337704 20833701 458513127 758889752 110207067 325522795 184402138 676025102 825972847 369214240 833580047 209178866 349618893 489920538 673470829 464962440 573393971 591993028 318165635 412939950 101809789 784792261 432409748 942590140 78498195 394781460 331614479 112108250 949671059 337056381 73027504 37260009 660731065 39071933 176245411 47152878 476343503 125649664 979250942 261003836 53011957 115411850 284286080 582855913 74954857 229800925 522188652 132680891 203962056 544361799 492476649 405677324 998726089 149131337 765167988 170163882 42789212 71863500 19461354 524855908 451304328 700954447 682369053 277382827 470246951 398828275 577629422 111946277 481943590 153630927 260494352 58060133 3817…
Output: 261554187040

Constraints:

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

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