CT32864

The Calm Window at Rootwater

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Maya the archivist watches over the mangrove channels of Rootwater's stores of scrolls. 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 <= 3734; 0 <= a[i] <= 1000000.

Example 1:

Input: 208 69 963217 79800 430544 370375 565213 469886 717887 396849 303050 855522 619594 202182 2643 465446 479798 345454 687413 854722 116595 714005 301563 253355 905867 432824 706816 39713 700812 439559 43000 912072 584171 541139 586688 601694 196332 978361 664777 647246 537799 167313 268985 254679 706168 978708 787868 492525 338142 93219 544405 574803 620662 24105 897749 353229 723417 310456 600424 200046 213804 748341 353109 484688 41262 49560 882001 322008 958773 774247 969471 399132 670322 646994 545704 451722 861534 95661 969232 389155 764667 318749 238032 580789 258297 728531 327949 327013 956849 281235 919216 501054 209995 571434 153388 512963 192440 944571 410144 458621 999228 297350 405331 440839 439082 647940 15518 730620 614712 565470 868946 841185 634661 498342 543842 165326 635546…
Output: 32418646

Example 2:

Input: 3316 926 52361 416659 45827 200523 920023 802042 327488 221381 598087 92884 17136 691916 984121 831807 961421 494467 43846 995154 650508 217484 972953 526519 897979 32153 269277 558350 445527 215824 867654 707359 848477 840607 590507 654114 336307 114982 12224 279237 98118 322686 539871 669790 744016 433617 377819 637148 414627 13859 505425 531120 465292 136294 319388 757924 977619 531529 486956 183636 27762 940594 603468 601331 750430 927657 65046 922734 928749 138209 740973 350458 29716 541216 520509 808548 33547 222804 960565 734381 106801 663321 442030 342995 605986 684120 50859 50132 840489 702342 277316 903169 188740 130856 758324 658187 531543 144777 670143 476732 752782 529783 310970 192348 350770 213963 191881 229539 110801 407171 483556 770223 773399 501515 408860 168433 192481 3…
Output: 433310917

Example 3:

Input: 2558 222 130767 730898 641180 213063 542369 586439 239563 515800 945768 545191 615632 26840 233295 846642 287896 448000 211211 435846 168041 500129 775885 280969 616438 101579 395091 629207 748090 2722 286613 980017 772392 177428 328988 592038 101878 170581 479948 321458 62715 26362 277547 911593 722708 828924 799096 174059 498469 433856 478282 51699 315646 461849 83988 499518 542658 209551 526001 316185 807004 894509 23470 834217 955590 819820 103334 390237 734551 184030 417837 240038 116835 690306 635062 448033 771882 517469 957803 563095 939030 763295 81827 665068 897949 300060 367800 716002 595524 793910 478053 190876 139506 150864 496005 40873 876702 780815 975203 134472 508526 873478 385292 740907 896914 90023 28720 285726 105348 250099 470511 664254 110364 935569 833780 844823 65769…
Output: 101511759

Constraints:

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

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