CT52783

Tailor's segments Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the fox den of Rustwood, Tailor records each segments 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 <= 2675; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1965 1559 917494549 368888575 901216874 133028476 896315677 382498321 446146934 574471878 661509202 913547350 823119477 812945439 612885394 396241964 993032159 819260242 598530495 635810989 289765434 533180218 915258403 566661506 603604701 196799239 817794743 517340915 352020523 539552886 216075569 581240212 13688292 255879091 244998766 389535508 43262300 880717874 726705887 826255833 460697552 183042715 449747075 366443395 215381790 922759392 390190351 944614592 681717503 548069067 416313201 587740042 541514666 778560048 935275512 427283609 809841386 571563774 684738007 311031095 361981940 408314315 650730475 802014512 572789205 750617550 656056822 369703083 909905752 675101480 838815814 482074235 583570942 56823939 813397161 152747796 23905816 412027882 586386843 260534366 547473204 4171…
Output: 768401505094

Example 2:

Input: 1830 1581 176183434 430287335 433465481 468247335 555211891 258615089 651697953 547789860 661203098 152391927 954255005 442368952 606235467 337306662 905982368 380046696 671854086 78890034 823475127 394387690 615131051 959308892 248872020 224797964 849687432 372304940 547968073 926329623 860922024 937482282 569762809 937059044 127923761 5746120 434607965 349151269 874088013 167304694 949183166 558548356 673229717 167701561 767781439 16207176 285886035 873700592 420875152 525364843 585853612 872417145 185430662 544923996 187453152 966229283 553536183 359292435 806956594 598807241 935556451 723138280 705487443 726986823 611382028 403283552 711989237 657996046 503442047 893598991 773499537 869408543 817587890 195027902 869725716 358432049 387731767 922536482 275018412 978029440 506081332 4759…
Output: 788904042386

Example 3:

Input: 2217 361 877318934 336292300 820112396 885830934 170324593 714896935 416204082 79366990 458037686 550311640 942338815 28573929 938870657 469366656 40777875 403797542 863172308 489970317 413836739 279642998 320075206 198086530 342391308 484089732 49310675 746982679 13973288 458083837 999040331 152741949 749472055 756112076 702514920 29354454 43417151 364901956 695881264 841584391 969294545 683186888 54666885 182843433 602782807 578487343 995409457 877746243 718514391 347924895 91766435 154274207 264473142 923063826 948451351 776457930 937691531 92885337 831129261 488593823 944340850 473856236 345602057 611497421 806836661 361983724 941274142 825829875 999331955 29133256 285589505 59262316 945008100 109786108 152180757 66186172 147984000 773434930 908619015 671280270 431256603 718921730 9602…
Output: 171699009304

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Tailor's segments Reckoning - MEDIUM Coding Problem | CodeTikki