CT37257

Qadir's Ledger of ribbons

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the frontier camp of Duskwood; Qadir weighs the day's ribbons manifests and starts the calculations. 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 <= 1762; 1 <= a[i] <= 1000000000.

Example 1:

Input: 845 557 395004866 625472265 453618061 38422605 896870378 339664758 255833069 403395094 580445707 56713284 514306734 215356011 157316302 348058989 869577653 204913351 495060924 77455074 175724480 122489517 474181131 974414536 843652670 374791442 830003797 512530046 500082605 846049721 548095430 329159644 303630796 863307015 637098950 238024091 735252335 468547677 567804970 747120779 952362799 610222939 636394038 540774379 555770020 341231680 664094612 158525433 504658176 540978592 885434054 276982516 239508297 557439855 42308726 835329759 403301813 816995173 318475921 613669482 206214040 577265217 243329857 779371215 345102180 120095496 506279252 264028011 855684335 592764460 372357582 974278367 692045147 570439483 951925247 593507650 490169441 184136015 699519024 329007390 425296659 802648…
Output: 283374840391

Example 2:

Input: 1176 769 113776995 125095991 359667539 556134020 985189399 824509805 638642497 289528474 358663262 904316024 114464104 884531534 140717070 60173007 874229018 149672990 249163106 128277794 855934875 587673500 341670877 413293518 970442602 292182355 812949074 17956151 912567901 393144930 944700465 930268357 768055385 187416456 494599066 815293785 32942261 584319186 380960313 39672660 961913026 938750153 910099164 987599307 352962521 57124853 729503344 63728788 113714481 47030629 260840555 576262171 34157258 3131558 111986909 736966958 25239916 323277499 744333625 712659388 272237769 469009711 947074062 445537172 300623484 666021055 662453967 134686791 631390141 701767047 251230140 913606801 418310095 764088314 743189200 738924583 908944972 397879555 103505311 803465042 672967144 791132230 85…
Output: 374345639382

Example 3:

Input: 915 702 297685409 816212428 599027987 544945330 11176662 730035935 96857922 527539616 880767041 229662071 589613113 80363013 946875881 93961771 773938060 665130234 233596982 90815495 597502763 289372373 870551505 259907742 211595073 548790163 547082752 479381713 801403305 837328915 206333345 262834833 246494382 987339377 58283543 373364057 299328989 761864624 718539374 272334192 982257994 735688407 734667532 931405564 107728604 115934847 224638072 73590884 527099475 129683178 538693260 91343258 498111246 929922873 805052958 258574651 340680693 273785760 355093495 811447109 206337853 792735268 303585663 467951152 674902147 930348536 745802760 910077111 59648591 192361917 231037481 260208966 830022995 591942600 316482427 519677252 845479950 474921585 106635417 329941981 899296249 357400537 1…
Output: 357662127853

Constraints:

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

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