CT30589

The Calm Window Beneath Misthollow

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Legend says the vault under the valley of Misthollow opens only for a perfect tally of segments. Wheelwright means to find out. 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 <= 1894; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 530 233 608803667 703125438 337046113 911531959 595302857 815142835 650820590 128939257 945689169 755514996 497660617 354100092 721735657 646283282 790546771 943065567 875866004 505769769 341256718 595392316 798747332 602640019 411532288 619447277 682744915 46678235 756463931 654802051 496024559 157576809 286265077 884803087 270717520 913007632 854822678 962598181 524851587 517984518 264087497 241545935 854591603 147679723 117379236 859017868 62716131 817268560 423129109 805111181 670078362 655434507 167592340 965346475 8810277 981102713 271451838 167434809 37260215 736401550 861616795 52084715 855517782 113965471 312823543 547536333 399859890 352627615 657063532 379922631 513615095 725928209 138971292 792038418 325622000 525087292 390385404 42870705 283726437 137836282 590677426 485004044…
Output: 114622133713

Example 2:

Input: 338 123 200362724 953367420 47181163 899312743 668053467 984850404 757041091 271949031 423229875 174872284 86598974 629978922 805800247 341949556 710293416 372166519 735725998 997702817 696378299 222795929 934078562 239372435 665679261 238638126 870995613 527416672 196180958 110446184 330636449 35121083 35151567 676596267 269548241 555671428 391195672 982809193 923802155 491150525 668623811 806857245 68869010 207120472 421267816 759317654 63970374 498783147 596433735 138055342 542659653 474958101 52998120 852815548 836367958 863699384 834595929 238147734 184335940 626143544 872024799 816338151 507880752 288055827 269705162 932945564 144645563 279609766 165344677 909899256 509258010 423728774 299695337 42841665 410553226 962988787 143426849 880012008 525504610 698366990 293219595 108090632 …
Output: 58993304273

Example 3:

Input: 1836 687 157854620 384099739 323276457 947409933 769786001 806180611 694198997 645118847 612788160 115817501 920229269 222601858 165349677 475436833 552795726 115890868 102042272 724991259 40512968 769124536 241429838 927198660 132795015 785612390 890021449 829932460 261195382 924887170 56697421 829140150 394471394 629905267 387282001 454793351 677407192 50429035 312196431 737542934 821307456 488916847 515752003 796002279 400783130 125812802 384372248 754080259 938478480 415722829 440253563 707948499 88626625 573826446 24507480 260275287 758256999 176178806 261727427 839735004 279005283 24342413 138074272 98805959 117907772 848573584 794325392 221177728 679987763 41720849 740056703 97109373 947697434 152041532 175098454 694127659 290025902 549758803 238128115 303523599 84413895 731364973 3…
Output: 337508985863

Constraints:

1 <= k <= n <= 1894; -1000000 <= a[i] <= 1000000000.

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