CT49453

Last stretches of Miller

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the jade shrine of Serpentis pays by the answer, and Miller intends to earn it. First: the full register of stretches. Task: Print the maximum sum of any contiguous subarray of length exactly k. Input format: First line: n and k. Second line: n integers. Output format: Print the maximum window sum. Constraints: 1 <= k <= n <= 3576; 0 <= a[i] <= 1000000.

Example 1:

Input: 1720 994 270256 840178 734468 847252 191258 741387 460248 729728 988672 433505 324498 370415 646870 260138 708120 356608 914657 317915 15646 610417 664042 54064 835367 321805 450961 332918 427367 966209 774446 609360 427656 530718 65657 949098 137918 409199 709856 774033 834838 265887 957411 811181 57313 654746 909146 474304 841937 506289 574176 924532 853067 236283 735038 244617 302082 555873 626169 326855 641807 562646 644962 314586 582614 138419 898042 414988 224838 370304 863844 936468 942618 247167 833334 816713 745101 500668 972519 231897 581924 718660 4284 912737 412829 907351 880022 956494 35897 18431 991599 849250 884486 902915 273073 980259 78849 570009 440957 995371 304900 65097 251783 766306 701729 677228 692452 851336 195216 439007 487793 256708 533502 981542 798130 520149 927…
Output: 504934572

Example 2:

Input: 746 271 828931 405008 289174 196537 67176 378713 275492 661187 65671 132921 343242 822762 960183 783670 510939 371781 937513 474009 162855 626882 780775 148908 89364 674002 210605 741541 880205 282110 422806 559835 365313 156656 347611 432946 915644 675282 371060 538905 920552 902101 337945 214968 444455 74533 537286 777382 564522 648426 135175 302440 822812 327705 303054 297568 379283 325358 507778 191360 435157 998903 585064 625570 18612 781774 106822 391009 941959 275535 747345 900469 156672 558982 166500 115894 112444 875397 239115 153478 257241 485727 601103 296170 260244 650106 313833 472084 212150 586231 891926 857028 776268 250584 832742 338231 2066 76716 871720 787328 549500 820670 406952 242612 565416 378875 230451 177386 693739 863971 974248 473390 372682 320833 77511 474546 708…
Output: 139411950

Example 3:

Input: 3130 2924 151297 941264 800258 562889 410346 505640 758933 118019 256349 968433 546692 688682 631862 649631 677093 554116 402944 902915 641484 463636 101878 309400 681096 962604 110071 52235 723415 427430 374988 766780 960495 220388 829698 954999 460872 443498 543835 160695 794237 592449 932132 774169 347557 145845 292426 38175 976947 559369 242516 766941 544574 960358 1317 289103 158246 865466 773929 227205 536740 923044 378475 809587 283950 947471 746000 556273 755853 967482 602199 509538 140446 558492 476930 723837 897315 920838 902774 49658 409878 362240 303333 235188 140188 806915 499351 92880 677531 460773 310128 168913 48653 359899 229046 472851 715988 549663 148992 23798 15043 749372 626499 759215 176836 623863 119135 808399 775104 690010 93965 674073 91794 790074 481269 464360 731…
Output: 1454481154

Constraints:

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

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