CT46554

Silent panels Fixed Window Peak

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The assayer Leon has been asked to prove the quality of the harvest. On the desk lies a long table of panels 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 <= 3193; 0 <= a[i] <= 1000000000.

Example 1:

Input: 282 16 977553771 412545259 673860756 976867041 694301468 941094126 336535144 917743171 553400503 142968357 952090540 199103139 434031379 537879585 301668356 924534064 815682893 887904211 656867627 460749773 303722002 196161688 875226213 596603286 391816736 84920141 266024250 118883025 401827384 780987937 983655654 130769551 69354857 901259239 930008513 113524671 935331801 175619453 105617283 742898652 496692358 295281648 567808866 931534949 555100386 933842421 422134726 145818987 350341314 770390799 637209073 379234790 696288569 62727645 471605137 832891256 188411307 753328018 206564064 833387825 971030497 211151570 572721163 36328639 19404136 314659761 291374652 289730982 687904353 80652234 787047029 475479704 72165695 380991124 482793338 549421864 444009658 810763926 429947027 354802612 …
Output: 10299285841

Example 2:

Input: 1605 81 51527229 302164668 529691476 784032593 735331486 40633548 597753280 488811425 639411770 622986165 771967999 816045474 33307854 630928965 734676525 317316498 17492926 45657863 841005950 322226012 12424268 162083220 873233816 269940179 426653536 96125461 336897184 197115881 263260518 741305071 538825708 210450612 657408838 15221740 620618840 505411352 471167907 231032579 594190455 48785169 383766645 192065424 499033304 31727237 61609897 364293829 174899763 518102769 105192615 520080059 966794990 578411462 787804429 897744300 335170076 752250058 593505612 120693867 925801168 477602280 641382919 854775447 954763527 97166922 71533834 332630355 237566235 359823396 659202570 99035339 102827980 107190257 360248105 974400259 70568642 686704948 328419518 954586103 763001757 102993332 4736206…
Output: 48124934307

Example 3:

Input: 2322 1413 312728632 909122622 438308431 101062326 636312995 323030761 669233983 412354043 52356939 607605559 631910828 548077915 965367464 984504540 896058469 217322338 234388301 68935019 354039630 809654458 962389367 465128504 667665144 722619909 556984831 998772970 365957467 716007748 812895915 800192928 412302349 479388850 936058119 853322596 578152051 957596070 928009831 178292554 972603231 51807840 978940538 533606032 601230637 723174872 661980249 658275722 104428934 31006662 728044050 284542107 584933625 699629322 368949092 398561906 79141060 181638755 544247788 36853116 364912580 12052192 826556804 667813813 988917471 628578948 674895786 650523188 353335392 713325379 499151034 982117021 759466635 903614418 594533525 31947325 765294093 93988156 112941599 148148360 134924468 209154108…
Output: 711866381735

Constraints:

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

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