CT32653

Arjun Counts the stretches

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

It is audit day at the obsidian flows of Blackglass. Arjun spreads the stretches records across the table and picks up a sharp pencil. 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 <= 3364; 0 <= a[i] <= 1000000.

Example 1:

Input: 2833 2667 583583 267798 190108 83028 255583 954859 752612 326385 563019 863258 484480 404698 95655 369960 247513 719529 306581 576817 54511 606964 744214 391445 503308 882816 472927 73599 374818 842819 736122 315943 437350 99715 532814 582380 451083 393816 157173 141029 437020 369467 173577 895602 261953 475178 467793 140785 795152 229638 154288 493565 676018 736053 556420 601084 909502 150357 568564 277248 159322 393451 912862 705807 468422 298788 147699 955166 446903 860114 225141 590578 697097 19532 583372 56513 736941 822995 735586 405320 86536 603765 161403 269063 689416 825705 448268 657353 66278 691443 728413 406639 950898 991395 200404 536254 413444 276630 965292 376676 407474 339794 443388 650975 6766 353474 441917 560440 705064 275240 854665 449675 668301 333785 731274 219922 837…
Output: 1334857371

Example 2:

Input: 3139 1471 103104 701364 975486 227903 547670 225568 778090 63323 644147 794926 677395 585472 227365 76568 802134 738873 582049 584704 943070 689397 563787 281089 896772 689290 608702 403455 393390 667252 698001 530438 434360 691724 299621 148129 868008 207679 97798 291576 795258 688375 413068 610349 279370 455858 396579 178233 90749 830163 313734 759961 699282 773526 140037 138981 620390 824760 372039 109198 174534 685959 100599 977585 742960 824521 545481 909520 914736 941181 50132 783783 709877 24927 295154 13716 264615 939245 784838 459473 781650 861885 624496 110894 485845 103503 245529 227412 622268 323510 501315 494612 208005 709335 22898 878205 205374 518975 389209 958975 973242 983245 995274 723193 702752 505510 226873 555578 846258 944014 408863 348041 98397 548054 839231 246019 2…
Output: 765750926

Example 3:

Input: 2734 607 853942 802710 3825 520556 728430 243324 15357 418237 644079 945037 459870 115047 39967 113811 656548 733200 7983 319193 308304 14918 354504 763386 858987 74800 672466 81397 92208 101878 78630 488891 560486 950455 73811 246942 796020 207050 583116 262188 674932 62724 707758 462894 532802 26434 766105 79580 176359 697082 138332 615370 471470 370888 831446 859259 640389 295942 239302 208269 116962 580510 831765 148593 956047 118711 25417 616961 654229 434759 537257 867196 702475 96470 440972 21793 898691 757431 153497 384394 410675 686248 790807 786039 4696 59165 199660 155987 296480 628654 841631 340748 206680 692042 76197 535472 678803 130751 2738 366584 657733 913922 12222 227292 161835 883210 518566 721926 77418 243753 36265 651683 846822 230080 80369 134909 257414 939633 56709 9…
Output: 315359326

Constraints:

1 <= k <= n <= 3364; 0 <= a[i] <= 1000000.

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