CT40991

Cartwright's scrolls Reckoning

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the thorn maze of Bramblecourt pays by the answer, and Cartwright intends to earn it. First: the full register of scrolls. 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 <= 3355; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 2399 1639 -646854 -379168 -169574 728611 -825491 271807 551074 -345949 623774 -121564 -156128 330924 -30038 222163 -879176 -514529 543844 -61238 282058 -8377 -811054 269867 489113 -307058 213542 -929240 255710 657737 987640 43972 65958 -175716 189689 -578654 -935129 -131813 -76892 511593 -67801 -571033 -47976 -339313 219401 -928752 -243155 -127438 -214446 -648085 -333324 50175 988257 382854 771341 -880350 -322314 201449 921264 278429 765994 -746347 -408759 -857531 -626071 624551 -331812 428339 972637 478937 -422087 -872652 478471 674899 932977 -142254 -786709 -509958 912165 543033 -161297 -924043 -869125 362102 732292 407117 15646 -548936 925345 343287 -211608 282159 714550 162110 209273 -900177 226757 -763360 -719728 834850 620461 -813366 649981 656969 771956 -417245 -209729 353254 516732…
Output: -8267055

Example 2:

Input: 3010 740 270440 -432096 -190368 -687743 613560 -591827 844696 -951677 206009 -636314 703976 -681744 773158 594267 -643246 406579 222806 -705804 -475800 285566 722152 -770455 45865 -542345 -446926 -218845 -94429 737119 28626 -686488 -443114 -511801 658165 -531227 746887 167566 480018 249586 -743978 -77196 -726400 600078 -598517 471233 -433607 -657425 -657494 -217374 209231 -504876 156797 -256702 938338 -643228 -862591 736593 692323 533991 649688 -125064 653939 757313 -628243 -49736 -672405 -579978 789711 690426 -793483 807043 682133 -516694 457799 -505461 873848 398985 182323 721304 -948443 428769 -464889 981322 704059 -803103 -448010 981208 389793 -973311 -243540 253822 841551 -404620 235177 -34083 -652256 -216704 -876404 -480143 989895 -295287 -740160 -771952 583053 472665 -92064 -531784 …
Output: -18167970

Example 3:

Input: 257 123 -126565 94737 14827 -397433 -354468 -633253 65554 797169 -895269 -860603 901386 539312 -564706 -703450 -712263 -995144 360708 -235679 -199229 -73625 -212516 -958387 -260340 604213 735668 770615 224041 869099 -686915 -77877 917786 -541867 -212205 -630672 -767393 547025 390980 -858592 -398229 -398891 -73216 671383 -508470 -854190 594003 -101260 589259 390919 493608 755492 736230 479106 -971282 429637 -149812 -205754 411129 -140683 -777304 -165421 186542 841934 112502 621366 347889 37435 476838 -16209 -982558 664984 -846479 726210 -116511 558030 695728 -258692 281179 561183 29136 -898730 679168 507933 926452 -298951 933278 18950 -886449 730250 -772531 -425914 -596170 -921443 907429 -569247 463366 685213 149962 -213938 724565 -419398 -349267 -689259 444873 800720 812187 177517 -87421 -…
Output: -390262

Constraints:

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

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