CT33218

Tanya's panels Reckoning

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Tanya found an old ledger of panels in the salt store attic at the savanna camp of Amberplain. 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 <= 1512; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 1138 233 -679839 620438 408294 636734 -859438 -792662 352942 266212 -52318 288316 -192556 403697 726255 252576 704378 -934653 19770 -382091 -200853 638988 -817825 486252 -331253 -525260 -388358 355583 521408 278772 -183498 -601117 -605995 176885 -133819 -805023 845995 181207 168852 533487 -440103 -764239 379580 255394 -253532 689082 -95830 -589283 -894335 45444 -720667 -598970 -182571 -826434 288175 -394443 483398 533879 624729 -974655 541696 272374 -331538 -99470 -286869 763524 -361315 112369 380610 981916 -827269 -718571 988327 -363596 -454627 -473531 965354 818134 180895 -560531 44485 171744 -702745 414583 311926 212924 900880 -400087 -118922 59867 990706 -564907 -816419 -451465 -842181 -791478 506661 450027 23493 -345844 444616 -8406 796231 -781337 316608 361915 576773 172565 454011 13…
Output: -25282121

Example 2:

Input: 146 114 19746 219682 428319 -66895 -52364 727304 -14816 784902 -245083 276645 865356 668311 911722 -466836 -960478 -504567 654738 -760954 274342 935957 -417839 342943 -468034 334614 669460 -393980 422667 917259 -417156 -492887 499720 -734312 -344373 -541565 929565 -600166 -166834 -307565 -953936 560334 -157915 -203934 -171875 623754 747631 244851 597447 415748 -49802 -232653 785265 604205 -64963 523908 -636219 574552 789364 -437608 612510 37115 515848 -168 -511038 -538251 -483188 909429 -121431 762166 -262533 -572183 -913790 -433654 795087 -968726 490255 456711 131060 376739 790279 -806856 831080 994361 710412 -439883 -412880 -765460 -126705 344845 -560296 357223 -329630 215052 -75332 -253404 -28167 -970105 998971 432978 721753 755143 -978362 -24959 -52820 -705396 -484722 104171 409587 -35…
Output: -1320352

Example 3:

Input: 740 639 -312976 -23425 752003 -676274 -513227 967419 878524 447392 -616745 -161287 300366 -135103 -730948 -957724 -211612 604343 468305 -371196 495883 -387786 -228452 561804 331108 -861263 -738785 202240 837373 -826153 -935608 300675 206781 -184260 -174604 -123412 -218575 652965 361199 927322 128307 -216694 -554180 505115 348878 -535236 131770 -903629 170124 379659 -804631 439998 -459413 463059 936829 74779 235555 -672474 98939 -635887 -766924 -305806 -270097 477463 -171948 58270 277630 307337 992015 -208530 841847 -657413 -832171 -195631 232661 -163559 27679 -80224 -421921 736034 284458 140673 -48827 705470 296242 -692170 -237116 -672296 -156852 769935 -747989 -726368 856243 208611 -762364 942085 767619 617445 -284575 -700631 711364 -465595 454323 -756401 -249739 -607587 -315647 959303 -3…
Output: 940233

Constraints:

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

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