CT32064

Sable ribbons Fixed Window Peak

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

The harbor bell rings at the pearl fisheries of Nacre Bay; Steward weighs the day's ribbons manifests and starts the calculations. 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 <= 2547; 0 <= a[i] <= 1000000000.

Example 1:

Input: 2029 7 911899046 654725105 261531687 923556058 725904610 481903743 978919989 790012679 479087268 266236249 988416346 809979632 122740171 237713588 504333965 565913367 180793159 903896719 395813960 174052007 801940935 974832579 745560423 961320933 249891890 404707713 625983871 546573163 547672019 545697177 593789699 234464312 745675241 922354836 533022480 88527650 569856896 936019021 859089490 659661360 159364766 232439846 305574999 710310484 93305743 255812506 19225354 439057761 770231668 492210421 84173637 761958081 668679486 723181261 609999604 410268063 502754604 53872533 603689775 908276344 41269074 689890730 41601755 358892651 550076910 907193653 308386277 496131936 58200060 53568362 173646395 651478713 441474515 796811329 727517097 616665598 625648187 273965223 954978948 581302790 82…
Output: 6170942199

Example 2:

Input: 1436 231 566679367 614059902 241027018 876423680 833378114 580442893 593547496 525590794 996991141 490220220 516409545 438077183 457281920 97959636 660833190 150332894 310544215 177720498 454781558 113285756 48045193 658293419 26024935 261843212 194469573 537983390 472651287 338364626 539540648 450675918 110900358 658838178 524582165 143824494 667934782 63485517 948156927 291867452 420882493 822993549 598667483 453634260 957106360 552846486 91293193 55439141 347876000 444285920 670361541 206073238 480224306 252428437 314049920 548848925 681242663 356759575 235912418 8720566 382478498 869682859 307399286 770558912 464939771 744977825 197959809 823336814 329456316 266196945 211005462 554985029 535321662 939575515 128810349 198837791 766948679 615016863 743415687 624984613 416112853 760225295…
Output: 125184031801

Example 3:

Input: 2008 782 814108096 720438012 391779049 226448321 496405633 268003265 127458306 88920456 904781818 101746835 914681833 659298117 312741764 949042323 674083847 192793599 307729066 594751681 849044884 885532259 778584718 751717662 241397500 160729547 504497565 854588725 166023175 975925139 180340896 398574315 90993272 508423997 530758850 945487230 549770819 734748631 70778909 306606667 78709271 307029091 613066244 634513110 76726772 693056241 494360244 187089072 225537560 776889538 320022141 284379459 913401409 565736273 505878984 164491979 93740455 251657725 50467603 60230979 226712406 741420486 297843474 112814869 150432901 75791199 927820713 813459011 978225009 844628406 610828428 834846600 649074330 371561550 786508740 576557688 351877840 583661166 176996703 852034457 532221819 699455417 …
Output: 397089231290

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Sable ribbons Fixed Window Peak - MEDIUM Coding Problem | CodeTikki