CT53229

Yash and the Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the cedar groves of Balmcrest opens only for a perfect tally of ribbons. Yash means to find out. 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 <= 3937; 0 <= a[i] <= 1000000000.

Example 1:

Input: 2431 1775 585345041 607165194 428886126 374521066 325034183 438618918 542668623 971727323 706082112 726704105 406284382 169228707 461605608 122504168 498195409 128899892 945402796 590673452 127047246 361039861 219458561 240673377 128835440 320569829 332926127 580959225 724096050 193524534 46086590 760217281 67205846 593071342 33098514 129812404 767790187 300542932 881022626 235601957 604168640 47016414 398551898 148331065 210046217 3823920 713281510 339203036 657732864 320661998 695676077 794990774 352521243 431307099 727497893 180394193 712238228 558079143 943373616 371000111 628238812 567746652 201475872 150675094 622269410 644758766 396248451 459372763 191933739 947180600 949127429 22896683 343685741 844070718 5766964 588478725 898174910 609182923 209110704 480620330 699636089 395151674…
Output: 875839662576

Example 2:

Input: 1828 483 518979075 801621607 853037323 330235222 219059848 596303934 397119456 373935139 423598039 177724352 854152595 953910391 794657079 61465194 199032485 978564808 206367799 62030431 877236237 691930645 452425617 244642665 700522638 228618687 994346002 285116 667321604 178967152 690684574 380782813 803651798 857977448 545251385 999514654 492752070 617598286 977305636 704727164 310101819 479903558 525874093 205578323 379421455 18354183 739895050 832582001 105610959 677798213 298691509 546337588 98068105 238424802 966624280 805829204 306542450 850634020 162346515 874317675 999092847 696303672 368161579 42500640 41353934 16695337 793982217 268119273 126624920 583867565 383034163 264564192 198988007 153706230 941174222 317138065 298043973 768524826 896314375 863839547 953386718 340583826 4…
Output: 239102050052

Example 3:

Input: 919 442 447547877 1834189 645594061 313374013 405177432 130758948 185408557 99620199 233777011 727458163 785825545 423780049 885728211 809340128 868595813 532126956 610307011 988070304 958401479 950804735 118442389 871666427 598274087 652961189 853788483 958553499 169669563 36536172 288822202 529465034 453425803 239043717 731303431 837742683 135777529 538155568 770775668 423944324 459641055 226047239 36312297 59785953 679758371 891694280 805523050 150439372 561161079 419873882 503000453 488285998 240861735 532397958 569867513 645683223 273262355 160632594 642013514 281680198 323195683 323270158 870157362 12535387 649975688 629869895 868481075 904046695 3624628 889593109 975810478 387620025 249153975 656466000 539058051 757821266 868828616 671986437 545030551 515878657 422088157 319290998 6…
Output: 216750428916

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Yash and the Calm Window - MEDIUM Coding Problem | CodeTikki