CT30598

Tempest stretches Calm Window

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Caravans arrive at the gristmill of Rye Hollow with crates of stretches, and Odin the store warden must account for every last one. 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 <= 3297; -1000000 <= a[i] <= 1000.

Example 1:

Input: 1878 400 -850230 -429170 -484218 -209023 -370269 -654851 -921437 -277524 -87240 -586671 -704717 -918295 -738956 -195606 -134986 -305146 -691084 -79763 -821347 -376710 -477790 -855751 -530065 -174951 -775441 -305539 -406916 -549491 -250195 -920018 -214753 -476433 -417849 -149186 -819955 -948905 -273999 -591765 -833232 -176185 -604263 -717417 -495279 -676964 -244581 -800403 -329186 -149881 -210813 -221662 -338434 -911966 -654248 -279241 -317545 -274804 -546875 -129485 -987294 -784738 -368158 -257819 -625237 -345324 -58159 -894752 -33611 -399213 -549590 -223040 -615320 -970546 -187970 -733602 -85870 -515920 -343275 -435733 -847393 -706806 -13358 -303346 -737204 -815631 -926729 -796136 -639810 -327486 -461074 -458786 -427373 -447938 -516836 -792844 -146781 -32762 -908296 -1383 -256251 -627445 …
Output: -213701083

Example 2:

Input: 1401 606 -392688 -556307 -53948 -751580 -59832 -682433 -532423 -257301 -524165 -14613 -131193 -287099 -410334 -779989 -916059 -291014 -861788 -176117 -770383 -58909 -959871 -296127 -600331 -242905 -354665 -295116 -125642 -921697 -783299 -842833 -356936 -197160 -744920 -974486 -937393 -658253 -682448 -101325 -114771 -389725 -257758 -406578 -351964 -575871 -95835 -544045 -250007 -333096 -337938 -159062 -380339 -333834 -485486 -226840 -552153 -165844 -451525 -326288 -717694 -551120 -705802 -882434 -486157 -711987 -938787 -107866 -802442 -704659 -978112 -369785 -119417 -620802 -254706 -658914 -47005 -540843 -853148 -49665 -162937 -276618 -816336 -703516 -152598 -977917 -966302 -968626 -52439 -947283 -386016 -525895 -491903 -395130 -184710 -595235 -716173 -959963 -258568 -973573 -939224 -766025…
Output: -328399732

Example 3:

Input: 2855 1052 -225695 -487723 -908007 -457536 -144806 -468231 -278546 -443125 -47538 -236542 -306660 -279948 -843357 -419294 -907141 -67830 -223769 -351902 -358016 -563677 -74347 -97952 -612759 -326104 -138024 -98619 -848164 -657682 -729683 -950108 -87865 -528867 -856819 -642300 -456052 -523287 -851095 -32869 -156447 -245820 -442191 -473649 -789893 -709177 -40650 -783670 -438432 -45601 -235014 -937366 -920665 -200123 -809668 -512314 -743332 -641503 -524851 -284741 -433794 -573015 -200759 -608914 -232491 -43317 -334461 -760089 -935805 -825163 -552108 -610876 -198332 -204714 -3589 -553564 -301491 -502810 -8177 -710748 -473664 -358774 -655773 -856992 -77737 -853662 -425525 -814566 -981294 -314893 -815314 -601612 -275145 -701373 -391275 -93397 -223837 -568039 -20267 -604998 -1694 -404272 -579962 -…
Output: -552382775

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Tempest stretches Calm Window - MEDIUM Coding Problem | CodeTikki