CT31368

The Calm Window of the Vermilion segments

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Sable inherited the counting house at the smokehouses of Brineport along with its curious bookkeeping system for segments. Time to make sense of it. 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 <= 2630; 1 <= a[i] <= 1000000000.

Example 1:

Input: 327 58 863404550 617475727 718606694 387937538 168221424 202979850 776090150 895235479 301924511 469122756 588212729 926625377 568217435 968925824 147194757 55589243 926832523 15938634 71620469 398511197 375299327 24040320 48923189 495676227 575441432 539942346 948071598 292010666 998034090 856597674 854425422 475806567 692388895 985149448 691433483 844033621 646584413 598029892 875368943 813069239 517451839 148153499 463854326 635971701 225656189 911366462 551516032 437425318 639835795 842570768 144142002 904017248 453107676 496062297 765768321 318663731 504620001 941490246 66759169 737275726 447754319 562730580 676139047 618291504 933294283 943514193 296366373 956271129 485107168 175835204 547622189 34888628 714212280 707497383 73529319 464221144 422141798 249863846 137139205 307392730 4…
Output: 25767131898

Example 2:

Input: 1215 431 794161822 773155623 238826464 645092849 272832717 235136497 425237057 895386700 38855372 624062989 352300163 466240210 909979931 783354008 259599 57302220 892725199 868251581 534566393 264360651 389617413 640181040 186207562 956120369 729893885 902738012 544143370 602689107 747838377 728708992 202424606 896668457 767617739 81616871 277914848 377837744 928435085 316259220 200149239 41830783 813399951 262717148 414285331 300768880 4847679 877966414 214290050 324560699 65349435 641053905 624336952 93658616 711480149 28999541 960262613 520148502 11845908 55347461 236792735 76090627 422128969 6553746 55124399 321774749 907793174 467760920 222320386 530665221 988729922 678260742 899815681 898224843 577744663 557525296 461950376 219699522 964301826 377927998 318233668 918128162 790239342…
Output: 209904581763

Example 3:

Input: 125 50 891607463 991895954 862633617 275348451 595894801 861889642 896669415 166392938 729380935 889362207 546182148 76650315 133376324 990613899 999474612 742041755 591920034 54110849 180450168 99455315 569684694 251057876 792884149 384626055 947243525 147837728 864116503 206491163 311452393 548225197 294010869 211310532 749479379 58130973 112552289 472756533 762643677 594165868 282017520 564045115 333074440 977327834 397644201 224425167 574737715 281083091 586386236 585100527 584160527 885269240 161628420 897269203 877935418 875602577 144273702 750011213 239689772 493062764 575179654 888502256 970462901 85184136 228017285 909081029 236991138 80278777 662161444 110182928 900434096 698281956 898052382 950231069 561306762 158117588 260067732 792153282 270790205 711163709 745157310 190731493…
Output: 23893047627

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The Calm Window of the Vermilion segments - MEDIUM Coding Problem | CodeTikki