CT33035

The Fixed Window Peak of Gearford

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

It is audit day at the clockwork quarter of Gearford. Brevin spreads the windows records across the table and picks up a sharp pencil. 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 <= 2584; 0 <= a[i] <= 1000000000.

Example 1:

Input: 2360 511 929094876 451040145 721942015 666547383 771051330 504227160 577681968 452903053 403366170 796713590 221855081 145455007 73467100 510541600 850957954 948111380 297672596 743166483 432253844 80870783 804663092 894291663 663621837 840015900 682617363 565692843 556794405 835988505 684440468 314818824 108175296 546909911 180890455 783601437 514924944 714970374 431469398 176600229 39619670 114046885 737729938 744333302 455767452 69473195 73653403 463041523 738663437 259966960 876928212 381196073 75894703 291457954 635863386 328803422 354612998 638473305 415461448 468246784 878058528 911807981 219466879 29968039 399438267 344514473 62279358 833652690 609561529 616520338 24818505 572200683 33814713 346581686 608003800 710348159 866782541 989748747 796633414 221432106 324291842 592229715 1…
Output: 268367587596

Example 2:

Input: 1345 1276 2619443 321189812 764748173 231780572 685902951 682540434 401301519 983836507 936309158 567163690 721842620 652406545 801605114 855860156 865723050 587946570 707247237 110805751 969294373 395726433 977677908 475302178 961920232 766807398 151189483 24206081 908725020 154779939 678257596 807531376 417153475 348205229 210112109 251411524 129266886 184007535 90835939 918358756 538478604 648029807 4948571 456242327 452266031 478168754 455224348 881953423 821146952 981670219 320708429 777434293 747747249 634895391 341715947 283101653 404514031 348180794 251464801 325583551 663327981 233700100 59424521 169308623 814344874 501857677 973952115 760136358 287563134 139603629 262189856 656983338 609561298 299722042 795149819 343316664 55520872 520631772 697984610 471770586 5722787 390354348 …
Output: 639685859633

Example 3:

Input: 256 11 246010340 862256065 804920124 949045658 697031720 348914501 36547709 333277542 514520936 455162609 150458067 721404009 267302127 234553437 914702316 986420135 76096249 836699825 899199415 827112796 122718915 732897275 65404626 472629799 799652396 655529919 169259271 470525104 984200288 372557955 454930908 63911989 770361141 808336525 299861284 614323436 426503302 96821429 18557805 509555385 605447121 487866239 69896769 247721940 940295733 439663556 891997799 387485946 884560046 994279083 238184192 274214233 253191331 408271019 763269379 28902048 108982209 862869086 755327717 813925992 298985340 25784291 752505050 643086798 429309820 670531709 404584108 438884472 894626994 122309782 659122311 86471885 393546393 406287603 219190375 266916980 308771319 582582642 688806375 649142184 249…
Output: 7119752698

Constraints:

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

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