CT40205

Amara's windows Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the wheat plains of Amberfield; Amara weighs the day's windows 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 <= 1410; 1 <= a[i] <= 1000000000.

Example 1:

Input: 690 493 931227647 80345618 589685184 252508938 15182370 887025018 422844345 493667054 295127157 586554085 613823621 108179802 126217159 648236294 201310573 264092336 309810145 143298660 68154698 430694287 811573122 818926510 619268950 629125310 912777470 539066612 100507964 572443591 923276820 691999364 309493328 56604411 807570163 437065149 865271294 981295829 934654936 45960554 561413782 972384317 232635737 944405814 12959366 156813192 546356043 846442241 609132638 932853875 801982603 597634523 541215247 492450576 142761183 767622036 429062231 131922872 466006589 229266703 484456373 9982806 996920737 953628988 749438930 70254504 524335748 51450411 386239174 224048951 859585556 771094402 361015807 824045819 605077661 324687722 490382856 903384019 899442298 444030534 988619413 628530839 60…
Output: 253546316892

Example 2:

Input: 1192 786 108757309 469634505 682461349 843994448 931428595 500907192 59136174 24955886 899572866 373290364 425452883 487639582 975435011 876260820 966002726 365516451 415704029 547475392 242332274 351400457 94529323 663051747 138667541 100626515 279420543 986035020 189617616 570674582 15544564 812725968 486733603 457718345 204367028 270665357 93691453 734056887 366266306 181480153 687495696 219538154 453306347 340962252 968971259 372887998 454948952 97484515 516292411 991760792 647153960 114624456 198219959 744622264 316856094 685319823 205585232 268802096 861668371 13085878 708646262 730718539 317764689 489955548 416946197 763234240 820405263 97459336 612602941 648970577 138533255 168338752 189197901 952594117 694965121 816248460 462987656 762479274 580175762 818412154 575568598 661375930…
Output: 400858418914

Example 3:

Input: 986 678 510241217 55412833 824324918 115419691 897947871 633513090 750106840 596621986 383297474 334171234 625162292 916287189 941564397 701052657 67808976 386227289 804340018 762536057 966306604 4346373 399621699 888504908 487755144 33857613 701922236 827810256 996257705 940415591 668723361 178252893 119282447 563275710 862502640 457039469 821130355 356264072 420557981 499570615 502598256 941538704 344529361 965954571 34594266 442467920 172628945 381181266 110653829 600530546 851961129 788976852 715539007 837750965 755185127 155385731 186867559 982119184 146832420 669935653 494203703 237030010 820366066 401462273 747488800 241474760 940787456 183625953 133903060 878336223 732966438 969434394 394370259 420387793 907260728 947982988 222993161 936669799 319381809 229353588 865983062 60406660…
Output: 342094028600

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.