CT33284

The stretches at Bluehollow

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Legend says the vault under the indigo vats of Bluehollow opens only for a perfect tally of stretches. Emir means to find out. 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 <= 1085; 1 <= a[i] <= 1000000000.

Example 1:

Input: 586 525 72593390 918076722 66199313 521812951 952398191 665448236 137465334 29798876 419498218 784225807 755882924 168187734 532195396 957087878 924198512 940223818 995085194 445642969 193279688 384462568 107273636 732353656 755237871 729652699 394676608 179731490 165545598 172709957 486431909 710675658 58695166 596205657 425722399 474035692 467750386 68299815 435621081 110182573 701424957 115581891 47325551 73005761 472179735 493741024 684991300 388350927 670930963 916524804 174175392 996064631 294457781 325917763 571829759 582456492 405662175 156748296 768630475 336125192 727696679 770792931 62586838 631297817 367418860 767820693 695221059 950693798 797887851 456977446 735535350 129157313 112596951 755330084 445975066 160588933 591975582 226848552 595480748 23467983 583629021 782834911 5…
Output: 268993607028

Example 2:

Input: 735 263 771019739 88810216 28036503 164179357 179398988 15810619 378355125 651253499 759179123 744201202 414010339 647328944 421316319 412314054 158357211 798920179 860033110 560888072 705207462 581753413 401524454 436050464 986139804 155624305 395196286 680145774 147191514 247002491 159035083 161068325 486533878 552997880 484329230 890900251 413623659 602793474 452755466 129605631 876624712 534312183 650725638 123153969 289726709 343080193 98255625 85783894 402544004 451201710 520448796 522514674 637781452 430484924 318330516 110285338 495289449 997592497 370423370 730304016 379003730 250833845 432650113 167163514 145334239 88243701 320138593 122198661 457910842 521245853 708878100 512921673 408793719 416838561 336823570 13139186 169050937 937981873 443084812 659405728 855397799 720656317…
Output: 135213961106

Example 3:

Input: 269 191 277269990 71907185 224477307 485813112 235575041 804877707 767266059 167519685 230626691 24636023 816053134 241531669 586078560 143260202 319413036 629921629 60941556 727684583 674727610 600803739 976652935 843336692 422953233 261872286 307797070 586827799 627001216 41569479 733293228 337026983 686211105 392028737 68514191 269090840 888919589 864709967 256609653 737071304 429539568 442709884 930998618 824189617 535449196 687232723 41779077 825573220 980687710 482747685 554750904 971446313 293832776 941062315 979793527 257361408 823188906 681624410 610963872 635399348 584197124 595235893 797907644 914786207 527870264 15491309 87506542 984429724 478326498 411191285 760561886 847960050 516868545 74248202 773674732 445141387 457686977 228340676 798079778 290653886 131202328 900914627 7…
Output: 97774128947

Constraints:

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

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