CT45321

Gail's Dusky Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The harbor bell rings at the shipyard of Keelwind; Gail weighs the day's scrolls manifests and starts the calculations. 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 <= 2831; -1000000 <= a[i] <= 1000.

Example 1:

Input: 2570 980 -312233 -772663 -359231 -646835 -50747 -361626 -618676 -803962 -850883 -100107 -983767 -895929 -841361 -367216 -905715 -665424 -677283 -595140 -690998 -291432 -203043 -294048 -691331 -887901 -220035 -489779 -622897 -94401 -983173 -135336 -169263 -561836 -265969 -260181 -884751 -270437 -905860 -563272 -903278 -543113 -289917 -668946 -835423 -654587 -441667 -455788 -943856 -209167 -31969 -700890 -915723 -599577 -154469 -930485 -148397 -783057 -738221 -797963 -840566 -109033 -580248 -623053 -428998 -503326 -363802 -203608 -289899 -744808 -503520 -171902 -689276 -379755 -369154 -933865 -255017 -132235 -218175 -205366 -391952 -903217 -462457 -689189 -791652 -4443 -546324 -133815 -665407 -784849 -343319 -829160 -346128 -503745 -829810 -74288 -648393 -697616 -527499 -947950 -836846 -9738…
Output: -506684138

Example 2:

Input: 109 26 -388046 -213208 -523910 -259242 -965065 -447704 -479208 -673664 658 -726368 -174378 -107315 -304297 -941336 -774509 -970539 -692789 -429963 -344112 -375954 -68390 -424318 -815491 -26439 -839983 -205017 -893267 -607523 -972408 -219214 -852887 -721222 -423493 -560687 -160805 -336385 -242399 -768380 -355994 -972283 -331952 -211705 -139016 -951299 -292870 -234376 -784929 -847755 -21437 -457314 -422277 -268107 -658591 -866344 -315404 -227761 -139963 -730040 -409887 -76910 -745231 -835490 -209942 -989607 -149192 -722231 -891100 -12982 -548883 -394038 -243855 -446236 -483455 -10715 -829348 -877566 -108811 -927656 -728444 -524087 -394873 -474637 -46586 -919575 -333006 -113198 -731057 -80536 -390157 -269993 -183222 -609368 -347018 -570532 -936996 -987621 -940456 -595541 -38639 -473488 -10225…
Output: -14054451

Example 3:

Input: 697 8 -855158 -463462 -397666 -653472 -597043 -986478 -951587 -273845 -897221 -916357 -874711 -285364 -297421 -983398 -974202 -968658 -964912 -988165 -613325 -278675 -151327 -954105 -998044 -488199 -702052 -306553 -703690 -430727 -772561 -815508 -80779 -110393 -533661 -354187 -652546 -646366 -888471 -379100 -912351 -790121 -30856 -867057 -668419 -483182 -840288 -175570 -7956 -138712 -989875 -907641 -562589 -673458 -461110 -435250 -884253 -54038 -3258 -157411 -328646 -886622 -955536 -454533 -762805 -79956 -185297 -681088 -97406 -908786 -490750 -84335 -232057 -230596 -15541 -839978 -97371 -840281 -148331 -485368 -322999 -359628 -430344 -422888 -552950 -304729 -37516 -789496 -432858 -226455 -626320 -865240 -868430 -937578 -704611 -744731 -217803 -205119 -546951 -26461 -144499 -589662 -612488 …
Output: -6336831

Constraints:

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

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