CT30824

Steward's Ashen panels

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Morning light hits the fjord village of Deepwater as Steward unrolls the day's manifest of panels. The tally will decide the next shipment. 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 <= 3685; 0 <= a[i] <= 1000000000.

Example 1:

Input: 3664 1498 360663418 978183009 559171546 273958899 787066847 530657075 426543528 630540979 787667194 930039150 598178499 152391900 537418601 988084133 260586705 684565081 525659145 589398405 912948296 96775787 85996735 311794133 651535192 157776782 820400635 759673804 706227549 904509322 145449905 487509057 687735305 717120268 908174980 436133541 519237258 673626436 971290607 671495097 169920102 151592065 743925639 215725593 681914485 765724686 181585344 119490623 879202740 175477070 590112304 877503395 516779423 615775408 718451125 198407446 285253443 852500101 48615613 120390643 730722926 393995929 88335761 321850633 648240491 633738615 587452717 735809275 115069540 913025932 164385093 162406732 622167772 777966086 790361841 783236696 96801683 414289141 216469630 164497444 971536098 83453…
Output: 754503696327

Example 2:

Input: 1177 477 18713229 619233535 846679065 960047589 414674048 391373751 394295884 636957873 883374996 804409005 601830730 350744440 856444271 536924516 869272487 244798226 322016309 258081617 797994556 426697894 771442760 961561403 754968167 89397839 952162349 234224363 331698817 618296926 769671771 490316613 672155643 61819437 119453965 52716688 413999314 106170331 953499665 685352094 397142642 495731512 339645137 486098190 962564678 939215295 901224370 880319396 261604221 421441907 378807927 597399610 694553179 414965543 154974392 728610684 446193190 769923231 50212759 788255018 326894274 326566482 970788128 274508741 449782063 445206983 231970326 141505550 804289035 644079392 846401209 723759398 628521493 636326852 446524571 187961501 520517531 362225949 491407381 894644362 151384718 396577…
Output: 256908053911

Example 3:

Input: 1953 762 705103389 961825894 586993820 554832688 89294118 275900012 369968371 104138430 375557692 726348991 629563174 607108682 95591645 616118388 224743651 798091920 599470090 610448654 806389837 813993734 421674799 701223403 74155448 874442596 861359965 994664747 495131406 795087272 812661774 832509701 140090894 82680231 770062771 780759270 486741643 930664152 512004948 743466437 993670903 909733998 324659312 991967611 546593189 13232053 865576774 286757205 160818143 43914822 654656770 12956307 494661993 212466328 790837148 86582410 697012174 946177213 446422487 801934987 402664426 141500740 933185346 471275474 356148467 71421635 576201305 982143458 247025807 791320298 632635832 946980896 868795789 552255257 670177080 196718568 621884350 67911785 339138590 664105829 683921299 384592903 4…
Output: 393533450070

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Steward's Ashen panels - MEDIUM Coding Problem | CodeTikki