CT56707

Ivory ribbons Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The log keeper Gita has been asked to track the breeding season. On the desk lies a long table of ribbons readings. 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 <= 2718; 1 <= a[i] <= 1000000.

Example 1:

Input: 2413 892 441757 195620 16602 50979 102408 366278 674555 68156 142029 338188 802924 498998 648964 426290 723807 14032 892668 593152 3803 267953 533679 133890 283327 835246 492958 709187 619786 132075 979964 765841 639870 471749 55494 999617 180720 147632 86363 660770 366271 196510 113265 727335 196959 446062 861209 728171 586073 89917 521615 735382 740688 601726 684282 468487 750754 223068 897900 327239 564748 633239 84195 283747 451492 529865 445490 825784 265221 202733 867419 959561 562721 328454 773943 244771 137100 870136 8447 78503 916630 130433 836077 152215 777366 256951 882563 83673 634880 833937 373724 399289 91797 858622 103352 998890 90047 535145 177066 208027 325142 201195 825965 459018 961365 886074 962346 772883 322944 48069 912862 851560 616276 618588 693418 97886 316208 2261…
Output: 438695160

Example 2:

Input: 675 576 575616 251045 571693 638 999855 946358 4805 75341 727219 877388 324982 809501 345914 543015 616355 461576 459952 746121 255779 94018 279949 666984 450590 984585 267083 563798 408087 773052 355223 886259 949393 287275 992344 302929 655355 557240 419306 632646 353899 937733 787170 627419 961965 974521 29028 886922 660896 618577 893076 407790 268749 800383 514870 105506 414024 137862 918727 73340 800222 967305 398606 195415 532283 413206 289112 745723 740288 238031 341849 249881 131131 252464 902135 442589 355399 616507 546635 220507 884733 74940 923526 324203 894687 933114 882102 794374 713001 448595 840940 911555 830082 349594 258429 782836 735555 927900 158294 750820 542255 893281 724008 502803 975851 192858 503868 229039 401909 287327 994116 650719 85776 282993 392545 94948 638408…
Output: 286267881

Example 3:

Input: 2700 1333 216251 263781 432139 768850 453652 545444 790093 671465 249562 456870 807686 403208 412076 262417 72021 317725 838710 929437 721548 344030 314018 791983 499596 392498 163579 724727 295277 347924 489236 581622 995581 198337 663477 93999 596810 531321 814067 544701 587528 787675 44088 953135 614074 707474 406669 992337 762507 495148 945373 959104 61679 481663 314927 508446 32506 558115 860121 822210 65628 61927 189611 673916 306328 50357 753776 903154 584187 100555 355062 957868 201482 829179 246067 853204 424111 26865 159674 247681 575643 79510 828809 533764 811808 363786 168066 376694 43107 494779 583027 50123 799713 278461 227511 497919 681823 646679 13134 669706 113736 401595 301922 331955 716369 504564 98772 975424 431192 884629 234644 438010 857305 692103 161583 988698 904476…
Output: 658809834

Constraints:

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

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