CT46385

Felix's Vermilion Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Deep in the maple sugarbush of Saprun, Felix studies rows of windows entries. One clean number will settle the guild's oldest argument. 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 <= 1878; 0 <= a[i] <= 1000000000.

Example 1:

Input: 433 236 361731955 832331818 781307422 145919501 446434030 514375089 626172065 481839211 771504829 240552120 872642693 258402571 412410274 276139127 936023265 298390104 963007901 822111514 910831516 556852600 890495733 768976014 671093755 824699756 502867048 675994774 867409072 93521067 800574877 990893691 953567141 394894088 900797572 46672742 69078304 842117491 90176545 938682489 47398819 356990529 445861968 840731095 297273982 462006841 412984353 422697583 732862373 47792388 728999004 122109657 873077347 294449322 458037727 415872068 568316008 463384968 728011414 590810118 621372753 413845626 404031848 27310433 105432641 7017240 223630775 113755594 673903276 870463527 676663788 7606773 529445904 480289264 62424396 937667147 152761265 445425494 857688473 838241132 623856189 310691832 4619…
Output: 121694663606

Example 2:

Input: 1342 1342 330298034 762470394 234643530 277656728 208819278 837585825 303979828 853194668 553807673 444707177 232940253 165020575 603086541 906078342 810293574 752480356 576792932 945149265 348405045 764787012 996116337 4648726 220591969 775639147 846163098 737741378 870252673 194262644 853254304 414474669 792681426 125239812 789015018 201341140 665872052 641543938 92888 885809960 281349841 410912505 967846558 759938320 833141651 694448267 561981384 18496468 244985967 233332009 603587247 266658246 286506880 173593559 855696910 516719332 947707035 216998859 924121114 398161131 383745815 301682592 436396319 55097748 959332002 945837678 748715377 265459165 960931708 341161852 327377856 396752468 143435413 13554690 368694672 240645895 231842522 767170612 425965689 958915169 383589842 779743746…
Output: 676319119958

Example 3:

Input: 1134 585 724115677 129487858 419482320 929365122 758014252 680694674 880309690 59050674 554923080 798179403 873418887 789687385 606163875 192118004 823802721 926947301 556491377 749296761 759993100 338130371 945611859 746823995 958619400 846099067 232002254 495759383 394235717 762630163 187514092 399166802 734817316 134175253 879958808 29771564 914447340 159999152 386689497 684810649 974162339 583622416 118313684 986886941 807528200 741921744 367698783 588583362 819020891 302735819 925603830 129759776 226891140 220790187 238098009 9721917 884748804 79721237 898356908 813335549 42600995 100724165 324064412 266709277 181555813 412840585 88738989 889580219 379838007 514718016 92430910 684964887 249674493 467496849 231926991 454503861 137507893 375019499 98605876 960668036 653091344 471029973 …
Output: 298833074321

Constraints:

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

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