CT36040

Tracker's Dusky Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the ink district of Scriptoria opens only for a perfect tally of stretches. Tracker means to find out. 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 <= 2158; 0 <= a[i] <= 1000.

Example 1:

Input: 1061 319 848 910 411 445 544 919 611 224 357 704 718 354 60 537 595 679 810 130 938 657 89 902 316 737 373 431 378 94 400 687 123 468 948 408 7 568 39 987 793 519 210 768 251 725 689 880 522 541 403 99 1000 469 290 999 329 607 676 431 652 458 841 489 94 144 485 355 283 274 525 58 214 879 346 915 10 899 278 603 837 854 800 936 464 260 845 882 470 450 563 439 637 303 489 250 93 301 654 264 71 384 260 288 593 340 369 38 838 565 665 365 511 645 483 276 302 526 872 68 876 316 221 396 290 464 948 470 691 898 199 837 139 705 494 244 303 382 330 430 797 770 577 393 974 710 29 444 804 422 762 892 550 765 720 246 270 824 477 220 559 114 971 330 217 484 483 702 959 112 306 666 599 828 365 951 436 579 397 841 756 197 519 59 298 367 464 577 624 271 42 459 579 347 925 189 921 535 535 857 3 793 176 411 8…
Output: 148733

Example 2:

Input: 1268 774 902 827 231 875 0 91 231 247 285 631 251 967 600 474 157 618 968 391 24 75 228 867 119 409 169 194 933 318 849 582 943 814 8 162 512 382 603 21 488 118 88 561 140 174 928 299 325 809 367 979 201 312 379 719 41 109 778 135 339 47 491 381 58 872 364 331 980 737 721 605 815 80 95 589 31 672 624 200 592 182 958 60 907 978 390 606 643 429 424 629 969 863 308 72 677 845 987 211 896 181 458 849 947 475 20 694 814 319 682 500 279 802 741 455 351 537 309 905 797 762 961 0 113 636 637 843 894 976 39 286 588 917 933 877 893 275 857 485 814 705 648 529 1000 819 308 839 585 341 321 841 14 624 206 866 513 755 984 798 167 181 995 502 733 553 62 998 917 319 217 824 306 246 935 57 271 573 430 601 174 859 522 707 888 940 348 662 795 368 652 685 713 392 716 702 28 191 224 14 824 707 219 458 666 442 …
Output: 367503

Example 3:

Input: 1717 140 983 225 312 815 625 426 638 815 232 176 941 770 68 957 808 230 822 232 28 204 91 451 49 156 450 52 106 742 409 829 381 254 670 441 698 217 362 822 237 954 483 768 377 978 15 749 466 563 388 231 358 828 511 881 830 567 57 116 824 733 317 667 381 489 288 929 354 413 192 923 743 749 690 617 227 335 855 651 619 509 257 974 922 812 541 721 376 982 736 662 269 585 701 959 604 776 779 88 946 908 743 246 725 760 878 944 217 62 80 536 700 974 275 563 688 870 532 917 53 386 207 971 333 185 854 563 135 222 118 914 935 314 992 649 921 618 498 681 959 790 315 538 65 544 665 701 152 391 167 861 689 72 508 648 768 70 385 698 1000 718 235 714 688 967 170 843 291 623 0 441 883 598 319 153 580 951 525 904 908 705 936 641 758 600 96 926 551 222 149 229 479 764 235 655 611 484 739 300 878 922 577 53 …
Output: 62630

Constraints:

1 <= k <= n <= 2158; 0 <= a[i] <= 1000.

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