CT48598

Sona's stretches Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Before the gates of the river town of Willowford close for winter, Sona must finish the stretches ledger - one figure at a time. 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 <= 3026; 1 <= a[i] <= 1000000.

Example 1:

Input: 2487 343 949826 54735 334276 776778 105375 752099 14343 669995 611392 657978 354195 54581 572219 122392 437165 210210 328118 375697 208078 340875 754592 146003 639245 917210 703507 637114 844778 539969 250000 219708 743501 160264 82788 886512 773566 218736 723752 178964 773426 44270 756299 379140 138914 629622 497476 676743 336661 855171 301379 411222 627298 135186 854215 112467 573980 376465 563040 58678 453056 629545 301600 733177 810513 595445 673757 844118 209073 693480 702146 97153 152423 940806 819573 371625 676338 881163 623123 901224 349642 83896 715112 150737 311572 305631 755424 833098 506383 59423 472282 549130 867660 700256 307052 474467 597877 359478 707475 908307 221743 530899 483349 486450 759894 570281 175481 75579 781958 430010 729971 297965 785778 782399 790145 678364 326…
Output: 163072889

Example 2:

Input: 1411 897 615582 601471 715748 522493 887485 206627 663130 727616 102212 329733 415292 727554 967468 962139 664321 474520 253180 140818 141472 572109 384662 338669 256685 861652 572375 706093 866698 854821 357172 565791 602556 905643 391885 454880 807293 516398 405937 52939 351719 77868 926077 674995 244074 615036 467734 565345 400770 11753 391977 611850 543859 289348 462184 220076 4601 822442 499454 688375 568636 425098 278531 372968 481406 312115 124795 442798 247971 267022 186600 331832 305026 620600 547027 580600 425532 362047 623086 254956 757675 251421 86502 661819 312103 166455 508713 636795 807504 66045 461272 765791 625986 894753 618601 457921 218433 665021 880342 777657 520182 177739 541395 883297 711912 615938 639513 808347 945768 685893 398000 697203 621643 303281 387851 833160 …
Output: 432462221

Example 3:

Input: 1927 1201 17384 353270 316921 124628 328524 246336 345934 234442 210713 262292 864172 955870 91197 405839 578317 437347 998240 917050 720147 300879 162143 554465 85716 697250 950007 917967 472265 699473 471725 774649 133559 290182 370984 670553 826323 660351 855362 736499 780866 781748 154982 184105 640376 429135 507831 316011 393975 935168 867815 84048 833894 654411 572126 56806 516242 461472 823471 453869 995280 393782 386831 769065 317787 512944 753771 646184 786 273757 940806 355323 687903 68711 903562 59292 921973 607341 967077 123552 295005 923036 21927 624503 52046 216502 904256 653987 648262 12388 754683 508061 429237 246559 266650 640725 643520 984416 120677 313006 857095 576609 104764 487997 163806 44550 735255 495257 161105 421920 525716 119900 220707 376215 154740 462110 287674…
Output: 579339061

Constraints:

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

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