CT46199

The Calm Window Beneath Horselord Plains

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Legend says the vault under the steppe camp of Horselord Plains opens only for a perfect tally of segments. Chandler 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 <= 1241; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 33 3 324270 994627 -873947 680918 -69605 -938732 -588476 851302 -685254 -259589 982446 272959 583965 -685515 -43106 -658246 -351137 -799464 668042 19037 -362091 261999 -65822 432163 160421 702015 -294391 -462714 -239048 -360148 22855 -714869 -433527
Output: -1808847

Example 2:

Input: 924 732 774244 523984 -613863 514144 54364 802533 -505742 -118506 -269599 201763 368588 55424 -340696 530561 577076 682731 -668885 -47874 -357098 -537550 752316 -468106 886058 533658 408964 747001 -512495 -939928 806800 294414 -847322 411471 701997 -307894 -217803 502224 -177328 -839228 255451 369262 727869 -3802 854164 -548807 75006 621460 -468438 -711377 -593207 305683 279241 211343 552369 773850 667586 -980530 47470 307625 670808 251191 -686942 -927338 -682081 -963803 -203653 202542 282265 -754442 -787214 -253478 810999 285887 755077 418396 -998003 963291 97044 -89433 -658146 751707 -792652 884858 -803250 -417088 -263777 -296313 -357596 -27704 769409 -437698 -416891 473877 -330821 190105 -263504 343812 303059 -94048 -210728 -887550 736978 -466816 -439069 339643 -135310 -105174 60156 -75…
Output: -2899470

Example 3:

Input: 1129 497 -455555 -420157 169486 -566037 565641 -339029 -526597 -167428 978122 -503151 558810 471575 387217 251280 951088 -81726 928359 847945 -844038 -569500 116428 -597418 -595588 550574 -177295 -795511 -643107 376024 -631635 818060 596011 398253 373874 -278997 -77980 266098 501448 495957 586338 -656596 276549 591295 -684065 242757 -144739 -528753 544418 -494005 157169 -402685 784450 -425900 645113 -289727 341429 436719 -495852 552139 720799 968539 -860584 69865 -682324 -449723 63901 368840 309312 -520371 -444625 -363967 550662 -771095 331172 774104 -368780 471698 -588150 606044 -543822 787442 -404821 256597 -851194 -851751 -530292 -598738 -162397 229628 967697 -930965 -402759 176632 477595 775452 456429 -475739 328865 557536 373015 573311 753820 271477 77470 362985 410608 299387 -3357 -9…
Output: -21830405

Constraints:

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

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