CT29389

Quartermaster and the Fixed Window Peak

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The council of the wren hedges of Thimblewick pays by the answer, and Quartermaster intends to earn it. First: the full register of panels. 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 <= 2882; 0 <= a[i] <= 1000000000.

Example 1:

Input: 2634 1691 968224734 256910435 39953363 974112984 825182723 643283740 861906001 860640484 219911269 159619905 721336660 526749381 31584708 571764568 579392262 685871917 572587281 436742930 221982203 116496341 720571949 612782375 616871814 228937073 42236244 27284471 695900310 762632648 728760280 161771395 297266864 331415924 393781013 260895437 785310974 143947316 612620993 659038811 735777332 689450028 150220484 554356977 743055442 343561742 69127140 144930189 431257376 583968551 287799484 815113203 432029384 591394049 164269685 62333378 577026731 76041505 270270729 78086898 762880128 254221862 551614865 495531863 905190917 928940845 431472281 195918202 755206869 314770709 193394761 584242802 4389999 570962047 529414509 728781701 277554514 294656645 477875018 358067095 456934611 233213812 …
Output: 854121003653

Example 2:

Input: 1207 864 78367304 827204667 951515507 68724687 849749828 866959392 312389653 219366505 184049991 114247218 120385865 255035907 713552641 181493861 683394752 502213874 994062800 911613369 786511785 453266215 222967422 754996063 784361752 603637610 591929400 634296303 739415052 37641691 518779418 156010949 595962044 822460755 958046998 625357657 59548448 480925464 436759064 163091322 778059320 855468311 780056202 158617525 107212720 159967849 765682567 776527367 107781039 59883986 290372137 449612683 66831095 766325788 220241958 75238822 691393409 191614728 364015411 358796325 81244944 622192687 509623397 196387710 600708795 824658069 918465345 533117455 165012575 80724407 437367691 90517903 5364674 48793301 287692807 983349710 545589137 686034654 160014928 21092219 341874088 65346493 469028…
Output: 426687757796

Example 3:

Input: 1702 1348 120751508 990507516 566742990 547477161 613427225 137048654 677889528 904208109 508163734 960180855 547617995 344445151 480055224 678793386 281744269 778972468 349483198 726970679 223795845 309637933 971295399 340772322 455455248 768359608 638356837 170497734 449247259 199713000 446190637 581105153 985341486 462904137 420060937 173406510 303242569 850632649 973455588 13407043 931746048 816867035 637323676 68449306 886279599 818885431 58241748 188621789 83068411 64984908 84020670 125397684 166640643 748290349 115326150 931454401 949841575 480714566 668544476 17721141 904331470 501474942 22129623 157267830 352070023 838182453 941940830 149142530 126869020 45322836 308326763 272859764 725251414 890720568 905009067 142719351 964699994 792959952 921871909 317548922 697549695 594078052…
Output: 675559687837

Constraints:

1 <= k <= n <= 2882; 0 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
Quartermaster and the Fixed Window Peak - MEDIUM Coding Problem | CodeTikki