CT30759

Opal panels Fixed Window Peak

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Every season at the lakeside town of Mirrormere, someone must secure the caravan contract. This year the task falls to Galen, armed only with the panels register. 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 <= 3725; 1 <= a[i] <= 1000000000.

Example 1:

Input: 2030 1934 599822099 259793234 352896389 790107964 94306207 696625945 987662805 28441457 485491903 313624824 74749421 436214385 672061904 856075159 504600631 811517484 711818997 884626905 649901959 910712411 74124895 672210760 112363258 316120001 770156214 317445912 614439203 398278786 820040907 466829275 302940798 267755920 784855234 620759154 637080719 798074833 556272485 298270783 62475465 472266425 32489808 123321683 349403434 309190351 927317063 199803145 395951854 283171828 91021380 997842257 603789963 562731635 542638938 976874913 707467872 196813478 32410488 666504245 377898656 65600837 274108688 643484581 630549489 401798017 152645982 737535085 961640728 975533574 84177663 364192089 289450781 321163374 168996731 496923158 672561899 756602439 715867444 122607629 375257208 294168768 …
Output: 996888143715

Example 2:

Input: 1721 1010 344244636 723415466 741229060 882720916 562040968 95252162 518843436 678422105 968417587 587433897 180488359 534397664 655659532 739941752 408981653 337423022 279076851 780665510 624926836 20174590 740531220 419004361 202753509 788986550 344957956 111936140 432163674 183208484 291443019 147809471 485953730 138880676 102370728 296250142 48562368 821353919 401100563 591675422 676302585 114164848 628580379 368084601 802787926 23342250 288871416 924996842 611080456 173102733 760384014 386037380 690260534 826371456 498014781 297704718 400142486 271013393 808987353 563748445 21652649 857371520 164971265 520026255 261380965 582764353 472266697 134310850 4159856 534725047 529987773 830268592 691300924 927956112 357817050 244553230 744063943 836663029 510522112 894929595 298910399 3933987…
Output: 529389011904

Example 3:

Input: 2496 1934 843361191 475562927 105781172 44640871 865710689 282877106 186785716 688567150 113034808 792428397 322710944 770433116 127121197 156348031 189823301 485208045 627926759 658474749 145338991 989840435 551422739 287024308 193181370 589350713 572114119 471964277 891027989 356512956 721301418 435768340 96487236 235947828 56991062 518907291 378698784 527970112 611946347 347367591 796491527 272560699 381787967 787995879 508708784 338222824 341088406 591931392 985002963 211626908 38732216 920626384 180588392 271659807 152696519 231063364 540836884 546751303 976967317 596033350 879465275 819371748 51218207 849970392 611474184 357489962 391016881 130291976 584945789 542954858 580150313 928794307 909637910 9444608 693472411 764925994 366618436 323709984 745049434 597212014 466666812 8803996…
Output: 969871605717

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Opal panels Fixed Window Peak - MEDIUM Coding Problem | CodeTikki