CT52569

Curator's Twilight Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The archivist Curator has been asked to prepare the expedition manifest. On the desk lies a long table of windows readings. 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 <= 1755; 0 <= a[i] <= 1000000000.

Example 1:

Input: 164 119 715379079 313908558 499102481 115294519 432275977 689887129 588325196 961554184 323732966 270604235 775029663 174263221 28314536 850309116 838957233 724830207 450098912 553592561 863081053 185400192 504576666 524493429 262666773 573260071 682839930 402847662 807730550 168553986 622870766 644308403 728884615 808312749 561859493 751636035 703020708 99887499 761549719 435574186 625934235 167950113 851495911 325562988 204023570 242604924 534110287 177432995 719163529 963760428 839048289 226729908 204382103 994191300 802407953 578894263 745167660 542779374 81959953 455875844 399529019 163385543 572601219 280499436 917630618 486808014 879303218 723899007 727764179 506728428 920131198 761169557 244473799 225799043 53127791 268597107 643172807 764965933 727473306 419517886 970932769 720259…
Output: 60119033981

Example 2:

Input: 1403 1307 850222777 158632375 158171850 698800228 144380127 447778882 228793749 222405366 935433112 303964900 960447608 363450415 627060759 425633872 789805897 595796070 860673422 863658784 740607244 877838116 204364023 752861338 607912221 184442927 749059327 918950629 670922452 797494190 606811095 756562247 665956512 923411927 22112813 552324565 965564062 131092466 444648893 196224876 273871092 847794281 509839731 349804167 350515386 700062699 338632804 926146886 288332206 872729182 22873690 867264420 257215307 641293140 999808648 119334734 415550716 881775212 639571430 358814951 990160772 394449584 218522455 94246295 437821196 395728791 696161418 300192402 351391791 88094314 224362800 880472312 161692365 182744434 349005700 186765298 949357454 501900377 556905950 89624932 422096985 33968…
Output: 657165214483

Example 3:

Input: 1601 1323 255503499 195252393 103935604 369134966 545004078 22450970 777878087 718143977 889638482 267083001 498328793 924384158 818402608 825540921 217361527 327055808 394878866 515326439 729173327 736902403 776057388 124029516 109059599 338653625 45793241 4154928 305588467 344603515 69006279 162284784 465357981 793705818 604395308 516249462 82818209 433047994 255372615 646213935 215237315 398931480 761611582 594494499 438467574 855847601 227292520 841239319 735156822 720363282 540641618 233584830 974827264 238480304 129272717 10227318 344924496 493744113 245177101 679491209 569690799 88475171 243813938 318178391 618754837 234137952 856557250 984531684 333103250 743054460 819062174 741182292 922963852 18544593 461245035 475454188 502700503 772163820 765952076 248518616 933257900 434841866…
Output: 657116046389

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Curator's Twilight Ledger - MEDIUM Coding Problem | CodeTikki