CT34360

Paige's Fixed Window Peak Ledger

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The council of the beacon hill of Lantern Tor pays by the answer, and Paige intends to earn it. First: the full register of windows. 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 <= 2656; 0 <= a[i] <= 1000000.

Example 1:

Input: 1485 1306 830442 921751 454813 679142 86835 996980 302772 434758 145437 695885 128812 442693 181614 659409 184644 742669 692228 346512 131709 320789 52957 542406 68781 52463 337539 589126 663318 665015 917950 830299 172870 717314 186078 96688 374952 837402 161055 998502 564357 908295 639639 861972 789137 258300 676114 717159 78124 684650 845322 186970 797442 172186 320558 302314 591619 790788 602538 98921 856999 46281 185217 748115 782191 412509 933258 787671 610350 169526 380792 428654 144564 4340 97026 908019 590416 177907 848423 37219 468136 140815 631691 540835 239837 57321 967244 923227 865919 656440 306163 736213 216920 455746 363125 390913 429955 384557 773701 690213 798067 987529 131681 365012 674826 480211 504633 439493 854124 597768 101627 420987 357409 230396 360587 413326 25996…
Output: 669393972

Example 2:

Input: 2466 538 528353 313716 663282 511617 502055 723788 498622 589497 574920 28121 801752 601733 507077 96863 983236 515569 249038 955304 847853 695457 635415 828979 896228 968698 946284 382121 290591 365896 12686 586128 281958 758391 87117 37562 250747 176601 242019 406306 148264 578794 870659 240845 320194 815803 885380 93611 476555 853913 385520 520137 452826 101429 310201 116126 446739 219007 183604 142068 83295 230441 516779 285671 37492 943817 789591 955637 100833 525311 777601 314744 649293 739461 885663 379836 561139 492434 589108 994495 749477 731738 111309 431079 312564 857391 463724 563534 261068 861764 37423 815868 263935 188221 77976 817322 471292 761098 903484 618628 509811 494278 213603 664649 634661 267897 627964 622961 240264 346409 32437 808532 934170 340257 287051 488155 2609…
Output: 292436091

Example 3:

Input: 1245 716 215334 192523 9041 733880 20138 567286 485274 276308 675291 994513 388082 306182 829222 690914 403870 637576 92627 966885 252063 203506 14035 559024 974979 482191 805825 466732 108258 916842 835098 924420 86711 158786 90361 927600 864883 850816 921523 508934 408123 303684 318968 116406 162176 645833 531585 594801 498246 540643 205413 97361 190278 328310 946041 366792 804186 101364 681728 129527 169420 670999 60881 190638 745739 759172 488972 490960 428769 627792 927142 519584 501592 339225 191509 989802 234084 653285 846867 108660 252519 319485 165779 59092 606121 781735 413960 763940 384081 391046 118702 314743 970327 912434 666509 148404 998233 404280 618592 841975 822093 507501 727971 592684 312199 349247 416293 672041 448891 249928 976592 849285 508188 718910 604717 201042 566…
Output: 367683199

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Paige's Fixed Window Peak Ledger - MEDIUM Coding Problem | CodeTikki