CT35476

Sable Counts the windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

It is audit day at the marble forum of Argentium. Sable spreads the windows 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 <= 1753; 1 <= a[i] <= 1000.

Example 1:

Input: 850 345 673 748 171 674 600 152 302 499 954 172 393 8 632 655 780 311 127 453 970 714 796 592 375 63 646 177 388 319 690 391 376 561 977 192 380 67 777 412 510 817 308 381 373 885 879 102 539 267 925 921 48 487 57 262 856 151 993 469 210 640 781 350 84 8 109 207 917 13 681 273 667 638 375 570 690 194 981 296 29 448 337 934 270 135 888 435 316 529 572 91 141 786 361 208 186 599 906 512 470 521 907 311 186 383 826 897 13 502 999 348 990 685 835 453 584 668 562 810 266 501 544 589 333 858 319 764 565 774 717 256 56 60 508 913 712 5 393 120 314 580 422 620 736 862 665 997 878 647 560 467 104 24 845 287 774 425 504 238 634 166 423 926 311 827 959 629 103 898 876 742 581 284 254 347 822 119 752 318 27 62 950 86 470 152 600 375 472 400 558 466 537 826 12 561 118 303 300 319 496 912 716 719 107 42…
Output: 173542

Example 2:

Input: 408 26 210 395 366 802 788 915 119 404 433 229 668 951 594 107 233 250 854 469 507 731 632 84 147 643 730 379 588 875 196 852 749 297 753 431 670 466 766 539 798 585 582 241 876 573 440 352 108 264 426 657 438 836 666 340 262 873 619 436 536 550 706 680 649 228 570 325 330 622 894 546 973 70 412 550 157 483 290 528 949 803 669 847 240 830 11 608 814 343 725 78 335 21 542 966 100 26 439 988 672 403 629 500 495 619 355 543 179 988 144 460 58 185 919 330 240 523 617 458 314 153 616 288 696 194 20 596 399 880 60 621 557 937 687 753 175 750 205 831 465 172 47 107 311 933 618 126 25 203 961 656 817 514 718 238 888 271 787 55 7 222 855 192 353 666 789 370 832 595 868 754 697 263 962 267 249 436 581 480 170 318 24 307 729 103 963 106 158 196 945 525 819 144 955 682 96 994 273 544 921 955 466 565 1…
Output: 17072

Example 3:

Input: 593 117 591 795 526 365 965 578 945 269 646 418 313 617 339 949 605 720 969 461 167 435 371 935 503 378 513 132 661 919 640 788 845 412 381 722 391 266 578 132 79 517 960 587 48 980 942 914 550 833 481 788 938 892 289 538 271 483 535 947 838 886 22 475 869 1 35 902 766 779 173 275 208 229 711 566 192 994 112 991 119 983 501 200 95 122 502 660 748 26 167 283 133 492 484 778 972 93 741 365 460 303 402 323 418 425 622 33 780 933 374 53 608 600 314 293 943 529 71 975 147 980 172 409 585 104 358 532 202 483 414 347 222 817 212 363 410 138 650 697 95 420 877 798 619 574 501 561 679 873 22 425 8 681 477 886 769 333 524 618 588 637 804 524 196 843 892 998 566 267 416 854 983 816 523 318 162 988 489 886 947 421 217 633 109 736 423 434 139 417 507 380 207 269 87 581 591 617 178 816 716 808 667 387 2…
Output: 64229

Constraints:

1 <= k <= n <= 1753; 1 <= a[i] <= 1000.

Loading...
Test Cases:No test cases
No test cases available.
Sable Counts the windows - MEDIUM Coding Problem | CodeTikki