CT47339

The Silver Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The chronicler Porter has been asked to plan the festival budget. On the desk lies a long table of panels readings. 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 <= 1444; -1000000 <= a[i] <= 1000.

Example 1:

Input: 1411 1144 -524998 -908778 -838034 -806833 -720948 -230633 -809606 -798206 -788348 -706781 -564884 -861150 -68086 -310049 -358254 -692417 -523751 -356030 -54636 -129267 -761902 -44645 -825702 -99184 -174155 -866088 -964580 -739892 -927448 -282826 -135541 -446188 -560111 -417118 -561660 -798322 -373634 -724962 -66326 -307977 -658558 -327414 -746521 -413436 -741376 -699948 -321609 -671675 -482267 -118254 -25401 -892208 -702843 -507628 -629349 -849418 -891637 -723245 -190481 -626384 -945070 -661215 -692820 -800993 -828952 -95057 -926876 -343257 -601408 -735118 -75428 -490590 -24530 -934088 -321896 -39194 -993280 -376744 -744197 -149455 -480430 -787326 -99703 -203839 -903019 -768008 -416357 -653768 -822283 -829371 -315283 -872326 -777695 -174801 -443912 -678254 -647662 -660258 -368821 -475171 -…
Output: -592201782

Example 2:

Input: 1247 635 -174487 -596843 -914646 -617557 -343344 -720162 -112886 -251578 -831500 -231319 -377859 -597360 -617310 -912230 -444349 -345145 -764235 -589903 -851087 -446284 -905670 -890468 -993726 -475416 -151128 -348178 -768062 -141 -895757 -857530 -84113 -463239 -624432 -965765 -622891 -304564 -263953 -158341 -850900 -387394 -902071 -724043 -263095 -279439 -227686 -149992 -202348 -138698 -362233 -157961 -988287 -92862 -834158 -492357 -604021 -767288 -286159 -641124 -160553 -678913 -303118 -237897 -408475 -585943 -377477 -302095 -34903 -992939 -655717 -48433 -348604 -221425 -175109 -700927 -312911 -894931 -644690 -249887 -218184 -210262 -967289 -729869 -39286 -345213 -757582 -333589 -738058 -72875 -926460 -260368 -426999 -110560 -686435 -16347 -193315 -170260 -749996 -589362 -129784 -591 -946…
Output: -319222017

Example 3:

Input: 216 171 -975727 -323361 -343701 -698348 -710709 -627447 -774971 -436719 -372793 -202243 -40503 -648445 -17603 -615343 -574075 -390639 -914776 -693288 -607099 -986885 -801806 -57082 -303338 -629923 -751180 -826995 -721142 -227375 -394690 -406117 -459364 -698006 -357933 -738871 -909764 -909869 -808519 -191592 -610405 -83312 -513857 -265891 -458487 -835820 -309348 -756746 -892468 -53218 -784507 -793960 -492539 -921972 -428454 -764498 -574646 -102088 -360668 -412379 -621954 -930084 -196282 -763265 -339611 -876587 -440800 -917385 -310750 -117562 -333783 -704281 -388455 -629677 -103437 -817974 -668103 -408196 -724000 -113272 -762468 -746986 -224794 -13720 -799666 -910813 -670597 -143282 -569724 -691569 -959176 -861207 -485817 -835115 -397468 -900621 -380473 -22968 -524671 -312705 -536796 -389556…
Output: -88354092

Constraints:

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

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