CT31680

The ribbons Calm Window Puzzle

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Yusuf the tallyman watches over the windmill fields of Gusthaven's stores of ribbons. A careful computation stands between order and chaos. 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 <= 2052; 1 <= a[i] <= 1000000.

Example 1:

Input: 1970 60 725165 661933 287847 475280 36341 959800 741091 107781 676678 433621 17136 477316 253390 526575 538928 17080 325949 262649 587456 116101 38678 342994 218505 257256 199347 594475 544339 482291 98508 889786 109727 808887 458686 146259 416879 924487 839629 554363 526794 47946 199318 329557 702574 984900 409005 783730 939742 564401 793066 659038 171397 245751 116256 158123 737128 328602 781951 441429 737850 809756 142054 729598 987201 793660 15322 489253 328673 319824 820710 525075 89536 723098 143952 688509 191867 673519 89284 22926 58035 556685 908070 334887 444556 708914 452539 30186 41602 381878 658200 376937 441204 195091 443001 690192 26145 256905 15221 87895 44654 692896 208426 77042 396211 993216 619357 845993 815693 765563 747375 576251 140091 730910 198669 876852 996042 82148…
Output: 22023370

Example 2:

Input: 1082 742 385493 27082 637427 74111 763894 635784 350508 474095 624288 210757 782648 759631 120359 291894 309110 102268 779119 498866 77188 526184 104694 256858 559032 436578 699066 748501 833547 479920 426952 63803 752922 154091 259609 704098 330800 387573 184707 178024 530175 369525 330931 957760 536011 238066 914939 963614 574810 777700 197859 551509 976919 329964 218582 690698 512343 582350 896926 21317 187215 12577 215644 415991 679538 148617 909846 295051 150387 605017 929626 555258 988765 152334 675432 270932 971058 773113 607624 782983 810924 813470 177849 278040 642273 131352 835376 351573 215443 546843 514290 716219 620144 821333 65581 934954 76459 455843 367759 410827 30068 426410 971657 928796 570235 602242 333256 13010 491439 556089 887854 264230 72013 63068 573230 849714 29085…
Output: 366165759

Example 3:

Input: 1173 854 609733 815519 201799 868000 369230 776639 778258 700134 19860 523052 484228 834152 336671 777156 373897 624750 773608 64370 768870 129887 611862 228377 303136 790582 162991 282308 419515 695735 795535 579191 264641 518139 958629 882645 143979 746738 816020 955930 559865 698308 669154 310387 846931 1495 375526 232051 440883 631850 279510 619289 646133 233880 827014 362888 714648 1888 345189 456114 220792 925110 440583 255288 196931 4333 297710 60447 426178 765523 105643 980323 247806 872381 46249 212120 875028 256986 251559 625440 224399 19274 237003 760611 393834 555429 478171 639280 172383 283506 364858 170782 483559 217295 792291 732635 348589 399715 513633 62479 917853 281145 599971 446048 772238 235622 904384 271321 261005 835801 831560 276250 818383 169351 705214 533091 18183…
Output: 422048206

Constraints:

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

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