CT48547

The Silent windows of Ulrica

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Ulrica found an old ledger of windows in the print shop attic at the poppy fields of Scarlet Plain. The margin notes pose a precise question. 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 <= 2907; -1000000 <= a[i] <= 1000.

Example 1:

Input: 2855 2369 -899858 -462032 -339405 -502475 -928381 -6364 -392950 -241635 -776676 -525875 -176805 -123745 -174320 -10026 -708605 -326375 -907929 -531251 -282928 -212956 -389388 -788009 -119014 -184437 -673606 -128409 -905244 -59887 -309761 -170201 -917675 -825854 -341828 -601489 -411234 -707412 -333426 -358643 -698066 -1508 -27030 -184213 -147754 -464286 -259962 -703361 -877189 -561564 -981455 -464 -702956 -377982 -104575 -434515 -152282 -602921 -35246 -119774 -588701 -703658 -365168 -841203 -60478 -455284 -412395 -390691 -937919 -983832 -682678 -300002 -202484 -560827 -422047 -15702 -850169 -647469 -34458 -732505 -242308 -741836 -631282 -805756 -906135 -308484 -626712 -128202 -180512 -838814 -570991 -888091 -720202 -705342 -513922 -800545 -897716 -835606 -981163 -32974 -281670 -162194 -6511…
Output: -1200605991

Example 2:

Input: 832 83 -905778 -876451 -991227 -434612 -627647 -204876 -694512 -700802 -241379 -97529 -567122 -708549 -251857 -428924 -838630 -194467 -340155 -496791 -123784 -124620 -373901 -899887 -523616 -811180 -436856 -453434 -721459 -849314 -598522 -826145 -570896 -764950 -834067 -24054 -796503 -305287 -915262 -938304 -201070 -895200 -125562 -814642 -556713 -892435 -201239 -387211 -670071 -599183 -260581 -638243 -879643 -772236 -26351 -639745 -241308 -447026 -770799 -289021 -890674 -87721 -876441 -753918 -351901 -541530 -368594 -684334 -503383 -548230 -175738 -733383 -551282 -59265 -160598 -290953 -798495 -704512 -543147 -774173 -196498 -169408 -679190 -868700 -630558 -371984 -450759 -585967 -429609 -190869 -887255 -169408 -810025 -795812 -819255 -486878 -288658 -428090 -674884 -479481 -791872 -42505…
Output: -46275268

Example 3:

Input: 2029 1195 -306937 -67882 -477852 -67997 -561531 -814807 -427991 -534483 -535015 -352980 -195675 -577175 -988559 -807777 -446428 -563472 -450503 -394788 -149734 -350883 -99521 -428505 -927338 -728465 -935538 -830332 -87840 -863867 -409228 -807686 -704054 -904077 -322376 -314586 -131774 -422800 -904168 -705470 -548900 -657528 -837329 -137727 -18336 -775062 -694696 -402077 -234442 -230675 -683357 -190327 -693021 -381941 -409339 -434332 -773116 -81200 -210709 -456601 -674908 -953367 -297673 -581216 -808860 -954111 -357296 -990303 -676665 -733769 -998229 -790141 -478221 -969318 -321326 -385324 -315134 -747112 -592756 -551046 -807949 -919104 -769124 -974256 -518996 -522817 -259169 -132995 -686720 -415928 -345601 -136307 -388644 -545468 -171581 -964390 -590079 -475124 -608060 -518082 -460716 -557…
Output: -598316142

Constraints:

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

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