CT47758

Lamplighter's Gilded windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the gull cliffs of Screech Point, someone must track the breeding season. This year the task falls to Lamplighter, armed only with the windows 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 <= 3519; 1 <= a[i] <= 1000000000.

Example 1:

Input: 3355 377 791724845 641581098 773426520 501085041 63448474 654676256 187670587 330065295 602425451 140066838 149957486 892582690 729223151 237123983 201516591 265697640 106783399 909365347 82619186 838766260 572322680 25866708 83467507 727769859 887379213 932192070 348603010 620232631 513265564 785972127 843636182 193816198 414221365 135439142 663512829 468976419 1428344 197131324 911809581 299824057 788675795 523655159 955789557 600204917 634285923 783924436 523664214 349107108 837784093 638042557 855942469 675110137 171479636 397471810 315576063 807721385 60380749 134718818 931232099 16736628 894171799 792942938 132008000 471485093 642752795 643161528 284554497 877121810 20698377 412536973 960348951 351800890 831976762 780519064 338637192 196971277 885070958 920273993 87565730 961096756 8…
Output: 201921168827

Example 2:

Input: 2108 1874 449569286 856153947 595901381 588859541 502949959 200952601 52825265 376852187 740900594 67097843 108486514 821506152 560032708 352893069 10060252 409060611 403232359 316269845 257967326 864139807 617776119 676671920 188090263 534242634 756037742 933558883 137210348 426369609 211598643 428608782 347111465 443874341 250397674 195044204 483630834 276322753 538787727 277489349 481198324 493940112 114880786 475291086 118084484 800554142 142611212 866668034 318709432 94002426 959041832 213716072 204828513 243936285 711012536 763787295 14517198 135594728 320931260 851992708 924194662 285571066 238260518 975700756 28932488 8524727 734634239 820200082 204420435 810723360 377095470 475464817 165348373 302634201 714308483 679910492 539301855 429703052 10046410 969332054 200623800 502847388…
Output: 949552122186

Example 3:

Input: 545 44 47486503 575644814 323338458 575800690 904482899 458784677 480561659 512372602 374053823 290419204 735423861 170290263 515000187 834491967 446065540 571503530 695093381 724720440 464633646 785709248 398748714 126952196 553053548 858421836 624752810 948877713 787406135 696704875 917553479 426060290 947631150 149635156 382637001 367225613 397513074 421160095 856654496 886600357 125388569 233145509 976484940 771806609 174953715 308634664 855013265 641129581 965100335 812109739 37598854 567866399 245579594 116762627 656655725 278965219 907505097 294640909 500748612 389632625 316563780 434006919 349959327 345733366 649305499 159120182 545741125 95982354 226219888 504728636 755867277 373453919 672512567 917403315 965157397 466858336 935535420 553912325 776137361 629127441 119390135 655997…
Output: 25798754129

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Lamplighter's Gilded windows - MEDIUM Coding Problem | CodeTikki