CT33570

Lazy ribbons Calm Window

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

It is audit day at the singing sands of Echo Dunes. Dino spreads the ribbons records across the table and picks up a sharp pencil. 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 <= 2080; 0 <= a[i] <= 1000000.

Example 1:

Input: 904 666 740870 870156 987506 440634 241636 860225 819061 981225 157257 236980 395754 969630 398242 239355 196563 295175 834941 413157 744402 295930 107017 49289 852766 506559 599455 559241 384491 380565 687150 89318 935376 122616 849626 672690 714768 36975 777764 94787 34288 903838 360243 566879 322641 412420 419701 705452 792990 102309 522789 948728 57586 166800 637871 131098 864182 377017 103842 980794 273422 413842 830823 183494 685243 169129 483277 745111 880899 904753 445770 669081 58674 405055 556904 765750 576076 80796 640423 37016 84063 436171 249043 330432 667016 626109 470937 114863 164249 611830 352138 332952 471385 992857 690587 334333 491114 377244 418918 226710 682021 650993 238678 474983 128974 708832 793005 941582 270214 764062 420387 363168 202696 16281 548618 446573 97488…
Output: 333102572

Example 2:

Input: 299 285 619985 466823 133845 39839 947092 800264 380220 310382 301815 235900 337966 232244 189922 194583 254326 556904 859740 428282 285018 110247 95389 295632 601292 941247 167742 358899 959799 560823 258632 730882 97364 808348 978399 37678 804735 578002 594540 106805 171925 841264 68988 910656 952822 574019 219426 146565 979843 201216 316515 269983 240772 819119 743684 596710 453703 618784 990122 904804 879486 66409 302287 274095 772332 115421 690330 903818 863240 245862 171247 438882 571711 870187 844809 98603 798110 808645 560499 746590 720108 157293 822338 768210 964863 66359 640237 366966 164676 397002 579817 84741 611517 268643 969411 390824 634868 298532 654012 615375 45214 615075 263881 453550 467166 266455 789789 94295 99917 732365 284596 125616 389755 915043 502867 49150 576866 …
Output: 142961324

Example 3:

Input: 561 261 40301 792129 106969 400428 745607 960360 979916 114236 168929 209124 790165 908789 423809 363592 814668 121908 908686 144277 190655 702829 82233 254101 561750 277204 435473 969279 249945 339852 742119 610035 748880 596896 134348 586575 900180 859273 431258 756192 10122 800268 256388 882792 520793 472893 191596 877073 75862 847374 914171 85691 402616 16870 524664 923492 29009 878786 626985 609115 259193 578642 973398 446944 399507 39082 273464 12949 815216 895888 986147 283618 84258 228081 635013 19644 399179 326980 576520 700605 293189 792881 94700 85009 970185 173675 712627 856279 347686 876297 677168 430460 577822 638695 941860 443363 760967 312731 700253 952678 725708 902600 767692 514263 816667 455768 777776 810352 52559 951532 427046 968716 340208 144139 578561 837303 350641 2…
Output: 125455784

Constraints:

1 <= k <= n <= 2080; 0 <= a[i] <= 1000000.

Loading...
Test Cases:No test cases
No test cases available.
Lazy ribbons Calm Window - MEDIUM Coding Problem | CodeTikki