CT33862

The Prismatic windows of Finn

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Before the gates of the tulip beds of Bloomhaven close for winter, Finn must finish the windows ledger - one figure at a time. 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 <= 2250; 0 <= a[i] <= 1000000000.

Example 1:

Input: 427 18 499796159 71082855 320102842 343892640 952014231 726352230 361594164 680742438 767542648 913133465 638400535 309117117 140337291 84921963 680613297 800391690 1228189 604443440 294860562 346501447 520515040 517694355 149026822 908434732 343194380 801158711 68840091 466240696 228882900 17063828 163147355 581866253 457681715 81403367 933741109 31203688 239090277 676438737 832881001 742739198 391231431 43092945 330423079 238075833 459532472 12813617 836682829 463176724 576784289 703540802 696135941 895315638 927551147 617827887 595543218 201320453 705862624 828916058 236272796 167010269 714037884 738594412 409226121 135383270 215855625 924061067 979841595 74969248 437792841 355470759 73673534 585248246 684485198 701816183 188186839 177139774 745318414 779218370 302519761 684699553 63192…
Output: 11798293447

Example 2:

Input: 2190 1063 399134197 829813820 832463203 9300014 937084655 207138921 868401430 561804848 212244550 357091411 15733883 27714616 210816658 219285048 653582745 353877562 513126722 351329439 147573835 371141912 106885150 956535936 154374136 613215520 572013715 147212856 506266248 573936966 403365213 55579394 775403531 105203274 880963673 907074837 992857181 666879088 377843116 78416053 915422113 31532537 445918763 225184840 486693064 277805624 676862276 520894123 688284381 608921651 286553642 896634113 153305636 328819483 290465190 57529226 386708703 677015468 452780069 598094742 611915638 551990483 975832616 174232346 36616711 287760009 638837855 296050992 708853998 123720945 701705983 430216287 22421155 160464784 511659766 633014225 617767524 133399412 811755279 525313536 184805793 107027958 …
Output: 539344696670

Example 3:

Input: 441 265 818321038 746967031 416737349 177408900 941207670 619868447 284464120 762093010 200023336 739244922 812377944 583586060 396548380 213271851 468902871 711418105 374406511 766507960 532593407 321524795 856705465 289104880 990941210 621681883 64816202 770264335 49526439 392761928 783105356 814632610 523892786 920466338 877083521 499621835 50224869 169674716 486408443 16572390 643412766 393399476 840825193 840515037 959883965 503952102 914993008 347421144 698974033 895887440 647253117 184553088 795376450 849071485 267380836 209861475 556424533 563532262 466175506 617128028 12446716 79736480 753053995 85911355 600101596 957163032 926863417 947203290 675283321 382313373 813501645 863547840 777900385 327917415 741020390 719603673 215049378 629235426 341364650 810897880 781913204 401069952…
Output: 133460619670

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Prismatic windows of Finn - MEDIUM Coding Problem | CodeTikki