CT46106

Last stretches of Librarian

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the lotus ponds of Tranquil Basin, Librarian records each stretches 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 <= 1525; 0 <= a[i] <= 1000000.

Example 1:

Input: 1422 412 984756 482878 712695 703162 970000 735539 727571 892689 338424 457689 515188 240539 703654 609356 152010 850419 151339 40999 445066 11010 557930 238753 147493 229524 871159 901888 920148 668570 355732 331103 941599 962008 709744 976371 752524 740948 863669 189624 739974 297994 32791 384071 150549 148721 121015 357816 142229 577983 391197 504908 719441 895560 955085 542355 95592 545297 314383 483933 387193 754701 905758 399 564763 8974 311545 360471 648537 47543 250200 518548 846070 212141 741005 979979 430485 155764 128188 638718 795598 960975 110971 252322 358178 228391 365517 858510 537440 268714 474994 818234 92211 206728 788924 986379 215770 379985 686907 884239 901270 734637 260891 180019 867793 484993 378175 986728 785041 872955 103008 332914 139868 691754 895935 217748 9695…
Output: 196235637

Example 2:

Input: 1393 232 868820 378229 660559 657482 550818 89891 660642 70777 35954 376788 26823 529728 20942 776800 35930 654275 897845 302748 119761 51374 31326 447080 778993 618110 61938 330394 266874 262642 199768 144783 37234 387152 855807 484613 85247 638469 814776 986519 145222 599143 220776 812123 401793 218741 261946 897465 546550 597967 642853 880402 364385 427803 186885 635949 584238 621023 203609 614169 810778 975183 139517 530326 649810 642657 385800 945120 699145 340954 3836 270938 312617 969660 749835 561265 861013 398749 782190 788477 499383 603166 142012 844037 792644 367534 944057 420114 708841 166516 603775 537833 880799 756079 698564 352799 369637 903572 430764 14299 407709 163903 423312 225021 255769 75164 998101 217735 475631 147875 568361 272798 701871 566827 350267 98517 735360 41…
Output: 104906513

Example 3:

Input: 843 763 691025 242954 667816 423776 394519 962679 405543 819577 136605 271175 133470 304709 849035 109839 319543 366919 858384 383889 252769 661854 814069 579598 875305 649604 266016 186782 55189 765749 839614 708128 658359 946491 769226 863906 11171 461704 718439 628283 644216 806179 143084 137228 563122 717062 119502 458444 394212 627658 589294 683496 666500 990884 38606 30233 562618 718097 771269 677997 209512 300567 608874 388624 441066 494887 551069 402031 943165 466127 1020 821735 834401 325918 255713 473655 776642 71871 26140 683776 649714 84270 663072 342524 52957 852796 940433 258072 167995 838613 838859 712411 855344 659391 796383 294677 704312 980699 381481 693785 165995 816139 675936 504301 76306 939483 607956 888740 600217 575363 364539 904333 516737 529825 158810 896860 35087…
Output: 366804982

Constraints:

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

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