CT56658

The Calm Window at Caravanrest

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

At the dune sea of Caravanrest, Mira records each stretches in a worn leather ledger. The guild wants answers, not guesses. 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 <= 2742; 0 <= a[i] <= 1000000.

Example 1:

Input: 1386 126 413655 403820 12628 792250 864402 161370 861659 25655 981918 721922 216852 453871 795146 742560 782868 377400 778904 833694 244911 948289 163459 345913 291016 390229 880051 359307 138544 10244 383733 218848 460993 130707 769556 248505 620457 427757 579082 865910 408644 149421 709892 635174 258598 457047 961531 859165 479593 105054 156970 337316 490079 50712 743560 68135 157460 511439 167300 24469 395565 824501 506411 73673 830154 981677 292124 275290 250781 299282 807006 969815 64622 38188 440435 68852 105110 236310 922104 957876 598314 763678 180133 559447 170828 295387 633921 315233 7132 685421 717253 69115 429812 379005 48588 826230 182225 451442 355080 471489 21455 686714 88970 788898 128707 332122 882635 352751 570261 970929 635687 258193 170870 201172 195936 290236 98798 549…
Output: 51410960

Example 2:

Input: 803 483 831941 239698 579283 86526 571157 978291 800737 872406 517459 434834 837165 631388 928744 340668 442459 834415 242986 917257 841430 76852 485165 899547 877048 251041 401606 171159 435201 632073 719890 230423 504372 116179 677669 687110 303002 636089 616647 436430 541123 290054 982610 571684 668949 268539 480162 473997 667456 549347 64568 922181 27720 457907 571258 722501 500344 735558 745293 771092 860362 84104 900950 751542 321887 114459 519376 707056 424683 506142 629640 613998 341748 537566 758585 353610 421616 295678 913348 553461 126710 534075 704652 715851 794117 508870 603832 989521 919677 527594 62561 19947 716746 175693 96461 563099 494232 889257 205080 606278 533996 284335 210989 473370 567473 682164 984077 423684 827257 499705 665150 694999 172356 664036 904241 532356 75…
Output: 232832224

Example 3:

Input: 675 114 272409 835984 584432 36403 215043 370197 977987 320089 440950 656618 995426 825297 953711 481026 965434 929853 391364 40893 86879 292108 92046 299304 443281 347050 880156 65525 274435 765614 727615 48663 848358 112750 216147 219033 315557 422206 400633 483457 793001 64941 277531 461507 283186 381426 88969 516224 762148 467158 41694 115797 193152 398391 288263 135397 202728 337831 222278 723357 754503 303497 405551 508564 491666 888390 489151 361877 505680 918049 425072 272560 653738 370214 675269 316156 651464 357486 217530 301774 67509 670726 506148 10628 270758 728310 77839 970132 282847 257104 781072 99990 788987 370516 373442 70506 151556 289697 591963 129125 224624 978333 940619 681259 976479 469410 123659 139473 643830 632351 615590 121338 342751 797120 62627 494494 667321 81…
Output: 48340875

Constraints:

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

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