CT56393

Urmila's Ledger of windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the pearl fisheries of Nacre Bay, Urmila records each windows 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 <= 1937; 1 <= a[i] <= 1000000.

Example 1:

Input: 1614 1042 511395 655273 772790 824620 438563 316925 385584 771997 246225 525240 913114 724707 788799 591793 372324 669825 881680 66204 913977 112882 705898 753725 388394 652039 9833 790951 479655 648013 156070 133512 830285 785555 311025 655057 824109 598276 112351 208435 408733 628563 889292 335401 542071 123946 590059 321035 953178 191281 361906 533978 93234 584058 767396 650960 238583 436824 114646 282840 187196 605230 311540 84937 344953 408540 609762 666851 128675 933309 39234 107944 797586 173191 349650 919251 513351 122912 290600 922580 557236 664362 683178 532156 484300 918060 181509 504614 702909 842848 152258 848091 132062 997349 120762 468022 663311 183973 68340 200658 227722 251334 589100 875258 403406 602526 396120 189229 106546 472002 973821 418906 459529 313668 362786 17388 …
Output: 526292517

Example 2:

Input: 146 60 636339 373083 467273 292232 666217 773598 934885 345030 825134 960856 115326 815720 740655 18305 197284 715968 808796 454593 841383 681590 546430 23536 259292 560962 583549 835748 313639 932171 432277 269812 220530 254966 600242 390390 612928 925648 839450 382149 457288 727001 433530 631854 976469 946798 83868 675577 405429 83175 402077 164561 150385 664557 337034 580516 386982 341735 714692 43180 352239 886170 27003 62878 127304 862328 690921 346363 150820 47659 983739 407191 129484 437176 285508 626509 600920 798442 63120 398091 139221 658155 722474 144919 903572 666346 837816 360609 480736 946192 656723 920062 3004 314224 29887 925272 343381 6283 134537 14384 610378 685029 298896 714175 281134 709190 85037 211299 121360 445704 984330 97122 849688 100446 519326 427925 10760 123667…
Output: 24954221

Example 3:

Input: 1627 468 664840 486721 102849 457670 568435 659656 567749 569172 542065 996502 475425 617087 768999 876828 694008 117917 228873 813608 404912 37825 414324 855297 590798 470554 173041 259049 115090 261936 217995 97288 667918 889747 269314 733224 256576 901026 427878 33296 362057 775604 149414 501801 216023 674406 316669 510888 387519 273509 445292 927897 694095 617880 586629 64300 551400 202876 376275 992993 221852 577866 8997 990191 283653 787197 367272 782878 934242 662274 453962 943557 404790 323294 880235 734031 82871 102189 681569 944919 253599 691031 590319 138363 626142 161841 478679 281172 55923 988373 251805 465365 254073 550313 597594 744265 875243 649337 6655 597364 249621 570134 102143 34157 163324 981942 217069 745264 186309 921564 783152 847272 334415 840195 429644 36416 34295…
Output: 222507514

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Urmila's Ledger of windows - MEDIUM Coding Problem | CodeTikki