CT41886

The Wild windows of Zephyr

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the snowberry thicket of Winterholt, Zephyr records each windows in a worn leather ledger. The guild wants answers, not guesses. 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 <= 1068; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 641 530 406806895 449593471 128724014 714419419 956133097 590961865 56371183 684211059 882971968 991665954 211041961 283276469 940596761 804502870 297250396 943692936 285482688 267214249 297417259 987789241 674656430 751254007 723959785 143438251 513876005 313035241 434920014 591404774 226870381 986532135 716643625 360168263 297644123 466249116 615011219 713916809 806486850 35381246 308211091 430305439 905757763 390901174 836749118 248659110 28475747 550448631 716549575 999955326 601654069 574490652 652082208 640943960 716602779 146329051 530666071 764346365 843166943 145550110 117131066 796018413 844127921 290350952 522507934 431043716 887449395 655762316 690119303 231442842 373623789 398372640 55819114 488640188 715933716 500482558 897624219 9620732 927727190 104999773 134592508 40721940…
Output: 264720779017

Example 2:

Input: 991 217 741559221 12071672 388969556 609196773 202480234 410601148 797697427 660639793 646434707 452194084 124519681 634651074 2723244 534227653 825643017 526337956 897520572 965610566 153257066 17424395 916975420 712362395 776592639 308074450 569308080 473379358 802817825 729130174 994570480 624035431 643149715 447573100 709413375 434461547 912457394 659656465 813811385 866161054 38249073 32856777 895838366 447116121 476449182 861706810 613875865 482041144 697671603 297284861 428466601 733811202 855987101 367245902 981062746 565237365 729432709 477728527 894990435 521896192 227384344 341635551 110010201 513378268 168301437 71911298 829025938 726224699 512769805 288790639 432066495 573394190 598570277 318001624 870494610 118047369 767539594 690115913 900637378 818529953 555621990 580122326…
Output: 117248554182

Example 3:

Input: 539 455 773301780 136470079 278665890 565753396 590455150 267160528 412397506 389301625 347195131 588226925 87352251 190920662 775591426 19434841 220550613 212519640 946969757 513708664 831334585 16938803 89222352 625053465 249514266 251016291 294735973 371536620 322494485 973987407 333826127 148374148 804028916 182670592 716646622 113608260 838406795 433630343 124275538 270500923 499105584 21540843 481104607 219560540 650880868 370594141 390446040 62663218 16032299 879195244 608930855 671433895 748848245 432458211 632408677 772751736 169738886 184578319 819529880 782907959 772679293 1428094 888228354 689785019 219502613 431252445 388857966 316081054 606170387 423566687 436130001 146893732 399901695 493275648 55947561 755302948 882830195 816250002 671393210 773164461 511290055 996502802 93…
Output: 235989166561

Constraints:

1 <= k <= n <= 1068; -1000000 <= a[i] <= 1000000000.

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