CT31056

Warden's Ledger of windows

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Deep in the quartz ridge of Glimmerfell, Warden studies rows of windows entries. One clean number will settle the guild's oldest argument. 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 <= 1115; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 942 761 -398198 -271296 367879 844328 860150 515939 433361 -177655 -529920 728106 -186035 -981744 371887 -729663 -99469 682880 173158 -728223 -70873 -72629 865554 -679263 -261589 557606 -246563 -57435 505460 17879 -864498 -701366 79496 210451 334779 -906948 472305 697922 -54173 -545527 337554 -76895 -375112 -314636 -465164 -341811 764691 449954 -636822 137502 202586 -554082 893152 -764344 494512 182164 40990 -683571 888849 -350627 949844 -616183 -947375 513607 -742833 -133783 102465 -553190 -284561 599316 215502 454257 615537 -130279 290248 -204226 -140565 -437588 44886 31649 -786870 -180501 -52646 -617728 -675751 -874265 -594034 829879 457322 251825 -381919 -120371 -976777 634078 508781 329855 308748 276325 813806 303292 -737433 490318 457315 657848 -190803 -904536 -386155 196781 663680 -…
Output: -27481464

Example 2:

Input: 68 11 26044 998071 -854541 787149 -166353 -859468 512548 632407 42460 764827 -870957 378 -210518 448729 -939982 -893064 507351 -518615 -835227 769726 -907690 150609 -189456 836239 -852994 862458 -253512 -358830 746460 -423694 -209096 -419198 854879 531768 -727233 -762469 -246969 -555280 726592 676191 874517 -375926 -642466 29901 -994963 910481 812235 -67049 -207780 -619492 -480147 -352572 -218140 468946 -68390 253901 869119 706638 -955441 -620244 657739 91705 15265 -936459 298638 17176 384535 -351711
Output: -3449869

Example 3:

Input: 832 794 -601633 -54131 559133 -85335 501752 -240315 693668 -615561 -443031 97933 -37434 -334631 7107 187353 922147 185775 -681987 -761295 630979 24264 471152 -385775 490293 718808 613131 780787 722293 732960 802256 -529704 -961443 966046 -597604 -405256 49192 61838 -494427 -955316 480482 -340007 -536049 -268079 -358973 891078 -237591 -733491 -916678 654936 396941 -825443 696883 35489 -367401 732500 281850 819469 -257672 -86765 970446 896480 187126 503117 -395039 -342615 -652823 612653 -312596 842045 886781 420213 -880765 133591 669484 -332482 387981 -956377 -394596 296576 880257 845837 -526523 334088 -24236 -123957 -82021 461906 262129 -376959 344833 -135548 318510 349885 -185358 569528 -966758 -413274 399745 485611 -989428 -692572 81374 -824234 822530 -943523 -415047 126249 -303493 688604…
Output: 27318027

Constraints:

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

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