CT45887

The Fixed Window Peak of Stillwater

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Fiora runs the mint at the crane marshes of Stillwater. Today the books show a list of panels, and the numbers must be worked out before sundown. 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 <= 2456; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1145 1043 556220933 180380229 483940981 885404787 30612240 723606229 157719488 36193706 693285677 337772502 199648182 820489540 387082339 274566815 94951180 965312607 282702617 965593469 320620123 401274144 511457666 359952384 348695075 867838118 228365787 175862027 805074341 924621167 523755124 769279543 744195141 175998201 947114633 258757177 744524047 205767706 166396455 791487161 412597605 400086741 44151162 108392162 697804603 41824307 477282486 292033038 566336934 342871344 245077489 773317203 976427812 681241874 302087143 760865510 742242497 340130362 305951429 467236484 51605152 209488791 506753364 13440544 646647927 693584007 466674000 394222687 515096474 524285107 334248309 91530724 110223608 249185711 169724438 485297542 390641742 821627678 651431999 807713651 961273994 20850099…
Output: 531675126331

Example 2:

Input: 943 539 465411046 16446529 752757319 719055385 252128684 379748337 36657711 85890330 338547208 70583561 29493959 805915412 427433521 820291804 912304578 706294178 109426389 367546652 825393865 242845605 643195647 731600040 569507685 178565357 607290091 286841849 988872678 628039350 423881023 596993657 773615957 149251025 911058854 876347419 83974281 103300837 171901376 703171086 751876028 432102611 728000837 819635195 553765751 886157047 117465207 949780537 542642205 52371248 264981720 668190584 73223981 5972218 437412371 462520440 754626404 39006464 979034884 570862523 986628097 922085615 162077794 889286865 714064917 472414561 783795346 701450703 295390997 133432779 220571525 996537923 461167921 822385064 234686697 603997767 194364901 807241221 158830087 858018571 146939099 746326169 870…
Output: 280658918151

Example 3:

Input: 800 344 144444228 442805326 981436064 986306985 530643349 105609153 253658913 645534161 660533869 677930694 768553249 125172276 993029438 626084762 291476420 280293961 367184152 387263881 445360698 129755466 915012588 224567571 408699644 314826057 353760415 204661896 324579370 429264925 435213790 305100783 929609408 67704973 838469648 849600937 348092328 991258294 243492225 766620817 868198513 660379498 363127784 288575366 315475714 907776684 371436206 76746790 286109552 721843925 200535567 416625787 986960699 804533461 893568312 632224257 699596475 715416116 648502309 526241914 876965088 530425802 456724891 519943983 72692693 389241322 180055979 714370798 459775750 563014378 687806802 208182490 781509139 417470556 168025219 787278476 602324535 768006489 521425065 681207074 462178511 73031…
Output: 181182248343

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Fixed Window Peak of Stillwater - MEDIUM Coding Problem | CodeTikki