CT41559

Tomas Counts the segments

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Tomas runs the bakery at the temple city of Sunspire. Today the books show a list of segments, and the numbers must be worked out before sundown. Task: Print the minimum sum of any contiguous subarray of length exactly k. Input format: First line: n and k. Second line: n integers. Output format: Print the minimum window sum. Constraints: 1 <= k <= n <= 2404; 0 <= a[i] <= 1000000000.

Example 1:

Input: 543 49 120335841 653812772 559973435 611464441 78335355 228799876 69556047 685445265 724510136 219388351 318203376 947102525 172834362 735644635 228721791 342549416 395333142 502887716 430509682 51802365 26658037 669510161 709151496 108519663 414831512 971049170 780714394 972334223 965412556 705763118 333531002 322617519 989771811 184500948 111297317 825528769 712930076 780961899 150518509 428860689 371047248 528519776 765598333 833436290 669300789 744319882 785075393 447201624 463811146 365319988 869407737 265316458 617270338 767173174 746696560 846933284 757360958 438090188 949657097 926377079 635867518 370157579 998448421 666561218 651180640 866545813 769700821 631939789 339216104 634888067 473389957 546604046 867641809 752270066 638301270 875586144 614743780 91108079 177135946 99716031…
Output: 19340834967

Example 2:

Input: 2374 1479 845837195 193503358 868155916 247848326 426321576 408413201 607912609 744254996 373791549 267029658 914222620 215727551 308456546 942263650 39517019 122889583 842519862 919539933 281264789 797769525 222083896 597225373 123979500 303000936 872014867 518419850 194459973 873100600 320797224 896045037 152799972 912984530 485636035 631693440 846721604 361366510 76615775 890888067 932413914 93414290 249729420 740605467 458233700 556331462 584113371 982936403 517962757 718462947 369837694 26817499 377759352 762992700 56500810 1032709 504111215 499987348 502555236 835264657 90593910 636127279 733023815 397102385 599299046 995500145 126158539 485784199 309279926 387131019 69156749 116670501 12978990 852484435 91731668 827969455 434763079 895397294 334126804 897753936 506130931 683598460 7…
Output: 729158642054

Example 3:

Input: 2198 1654 793742091 678879610 659304155 478441101 102898119 637087389 265941191 40625013 751674907 852375499 275923469 771810245 416750080 930516607 102015691 537969539 95133570 947774258 956282298 622760978 315963623 267393672 390060471 45778030 996449364 301158122 291680178 458087702 618866673 45156727 961271114 700664420 623826649 289900402 534625574 665662032 712708727 709771542 74658391 150512965 633920443 254385745 95881126 572076056 120004149 559307261 590101094 436011283 291168105 534526726 38104806 394372975 442317362 206490946 631715457 640494335 151084261 851107117 447792114 51104446 336252423 551684940 851833108 227571747 442570098 370109271 229824882 161938398 663566129 459313496 928699222 325581446 49353555 988822233 674525153 64317854 808507121 243019240 436535257 247736470 …
Output: 813807143544

Constraints:

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

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