CT57110

The Fixed Window Peak at Mossgrieve

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the peat bogs of Mossgrieve pays by the answer, and Elio intends to earn it. First: the full register of segments. 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 <= 3925; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1789 1585 780124728 930169734 29944290 880571942 949730369 249561567 882433662 447450748 753030176 730179806 597152490 694781713 852791107 161309935 478788914 741099886 909012825 931160594 195744038 136502320 817213543 886185873 674664218 630312068 435306077 212885662 265472667 683233303 176305294 298666110 351638864 818635902 5585982 313664637 985377455 972422565 505581924 228774368 243472091 3532030 641862369 943929163 764664631 448255776 410583534 78124231 782789473 883785295 982818609 388501580 140499189 730651107 882755535 800678737 683192006 310505304 265125024 873435629 833343166 819074339 434750858 218631885 247954285 806920914 244310197 88247727 500202377 239220824 950834213 240897732 874360032 339420398 556008334 301797843 588877283 795045981 9975132 766692110 929488552 176710287…
Output: 795648772675

Example 2:

Input: 3854 1935 823762459 557237876 425569157 69392912 575578829 247663745 811523662 161394811 431062565 645091757 934973300 439383024 44022000 393272436 896398894 994841936 487525026 627292883 690718091 674023949 631384291 691239566 230387026 699348797 16630629 228003829 12877819 543588342 797592922 767045729 358228905 370580437 904512758 318447138 942677478 763548399 606549410 422018011 500419209 220441372 830437426 267450358 969150269 31030288 608208934 417925480 435935526 794965114 181381551 769917787 397440385 383579626 314209525 952566296 745085149 116879987 843766061 64669578 84648937 285719625 698583044 698492398 246090531 722119542 63955480 789543696 970577844 238783616 754420010 962840401 641119111 372488385 454909910 604207874 64618900 437169181 900038759 644324158 66659249 691021047 …
Output: 971476538017

Example 3:

Input: 1166 1055 855396225 288243292 201747115 338197434 504345868 736555591 583259133 953928338 996349677 335287202 941302107 749473864 231423440 118946667 878441214 647780617 813413068 483447053 451642425 694655547 884129998 36404961 192714692 830601536 112125826 286990119 973450443 433910610 69301750 638325333 182369166 543299165 830816508 594125723 552177604 581576427 164854178 914988833 165329236 898732507 721365100 419451393 190726525 937988612 313202568 58631083 707746480 262977150 520435799 123608803 688071208 103027965 646974403 234032880 52842166 767750393 115796998 893289439 899040693 311610094 287931908 433569969 364513276 115063675 714978939 263154813 637691005 966412901 754499236 691511666 141203116 697264836 994686390 978040177 79962273 355093480 60134069 584414829 929066676 623207…
Output: 530029534079

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Fixed Window Peak at Mossgrieve - MEDIUM Coding Problem | CodeTikki