CT56721

Alaric's Crystal Ledger

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the crystal caves of Luminar, Alaric the accountant keeps careful count of the windows. Prepare the guildmaster's brief, every figure matters. 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 <= 1837; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 1813 1257 356556 59377 616337 491534 273154 -443926 -411616 447831 592915 -113018 224598 -397070 984379 -458485 -10486 650791 -676224 -933490 338676 -131752 -39050 313790 712134 -421096 922120 -561196 970594 853423 573084 -704699 328706 -592058 314530 -899276 -613276 964019 -401503 329674 688525 -993919 -677754 633427 -979946 -388605 -483148 249967 223909 -557257 738755 -586271 -89605 -716233 -869198 296379 876827 224095 -774256 -388341 -850257 139335 -876185 443766 -782310 -460507 883931 -149745 -706580 52754 -694437 -114487 587211 -480874 -322961 -182227 -503184 882598 721091 28068 638784 -627083 -362782 715537 487635 -902161 935419 -251004 766163 711246 539327 -816778 -793421 985406 -143037 885058 -252910 -795151 857677 368727 -141115 -713336 29861 701310 748795 649206 -306938 -568851 6…
Output: -17680128

Example 2:

Input: 1312 171 771848 531127 -813165 -207613 -794138 878793 -602038 -147062 -515449 -352376 992831 156128 -201177 333784 148845 947994 45939 707305 -856045 -110826 431499 609608 238044 -267914 515631 -170030 386895 -154449 -88675 -375389 214470 873244 438619 -972759 -639669 -38967 960611 -79114 -504196 991544 336835 -704722 -44280 -345824 -272929 170078 586395 -929102 733757 -515012 -478311 779073 235168 -545166 -160125 -817572 -230008 677471 380431 -505517 61216 -106623 16551 -175685 333103 -955779 -239285 731055 300719 651626 -29281 -234743 -431432 -464616 347626 774829 302808 834697 331577 859108 551035 -173891 -294272 -679654 -657252 -9300 -198346 646888 237008 436730 369139 -995419 343250 246970 -518831 -535210 221757 -556970 -724347 678780 -901689 -328678 -602228 578346 -29055 633579 -8281…
Output: -15392446

Example 3:

Input: 1808 1796 -141667 110049 862696 -373356 508033 -399602 588713 310155 168027 294754 -739117 800588 -912832 -869160 -870145 74534 -76853 952790 -866916 78568 315263 444316 -458081 118812 -756979 186998 -553912 782557 403662 538870 110159 -70389 -679078 679103 595162 -492823 -341812 661286 -235338 -42457 898634 -755633 -164515 553216 852718 -846473 803307 -384698 982590 441317 118686 991250 -956152 -459181 698218 941818 -763583 525788 -736129 -946422 -421139 810678 223189 588325 -608294 724260 -79507 780408 -658242 530873 29172 -947698 501249 -475994 158000 782947 -47517 -846418 65184 361489 178953 -385801 32695 777439 475178 488346 617195 580925 401539 -783948 34258 414609 673041 725675 199492 -938587 446578 477055 38528 331826 772154 -714316 223854 -448686 -943945 926198 783442 -310614 -715…
Output: 27797564

Constraints:

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

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