CT45552

The Crystal Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the caldera rim of Firewatch with crates of stretches, and Sona the assayer must account for every last one. 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 <= 1022; 1 <= a[i] <= 1000000.

Example 1:

Input: 600 317 916244 469455 204376 105505 465547 697313 40487 375681 91585 974155 733266 34038 572206 594310 819152 471330 209223 432974 886491 589129 125996 769937 831385 736349 701736 837110 744524 384443 808140 380269 677755 753212 440589 125363 572931 170751 869349 996585 225747 897282 877719 876540 699646 502636 875650 455836 272137 68920 735816 300685 985137 436152 254662 715906 202582 961860 50315 240284 333003 768610 466529 448530 883278 206019 952002 817906 493929 783559 682003 393173 863331 919354 533858 313479 881943 622850 628655 121692 172696 865897 417636 249931 114895 945177 988808 125612 403110 986570 199580 694399 432480 596068 667516 981121 597693 918461 735233 839107 495514 142568 129134 649261 340387 391426 927464 113451 707324 966054 500131 703674 671123 719853 224869 150498…
Output: 144239765

Example 2:

Input: 415 387 81228 869509 575957 538073 509830 85307 248459 623678 936491 253701 883992 8957 526827 708298 197697 928277 713528 884666 8413 726198 3048 619379 312649 581160 312220 645781 272727 684434 605236 58769 203788 407395 766961 282611 456188 389784 4660 679628 792932 774157 973008 985906 339824 697701 657548 189944 693884 323739 562381 482886 819121 860811 630055 702495 829111 200262 223105 885362 598521 877651 983310 470610 983806 439482 446989 897879 531662 165566 777147 52365 545816 211257 25688 210737 631100 388501 524351 474567 792928 275116 605344 345166 540209 825376 880278 367457 159885 920604 706711 504645 492077 916243 247917 139260 112875 39047 163536 779495 852711 360809 371950 312023 75653 753640 718721 154317 164473 230236 549191 625635 509900 663596 414138 240070 742979 15…
Output: 197750838

Example 3:

Input: 980 409 842959 335056 252342 804027 530096 968145 165385 43871 637501 471154 478277 501675 626495 309239 769240 329898 797895 211031 663886 893636 403136 1710 839275 311021 595785 181021 336665 182955 910125 228886 706099 577556 106248 195710 906267 899549 873069 632873 105738 926425 628292 653227 925917 16817 180863 673318 180832 663782 705687 41644 990917 345429 458397 732754 242165 537830 635141 690128 277779 751164 47457 760997 551663 84284 766865 443929 438849 295935 81612 570629 96406 547582 764979 801495 598806 251607 9686 191511 286042 686918 863277 620018 580533 514741 368711 245568 3611 364412 552932 557844 573825 792049 178190 581162 597191 40047 109275 798370 216861 630077 545728 569457 575180 981690 651508 134776 619584 69197 341058 276813 292853 15079 617896 877124 800643 302…
Output: 194533759

Constraints:

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

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