CT41878

Emir Counts the scrolls

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Caravans arrive at the mountain city of Highreach with crates of scrolls, and Emir the factor 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 <= 2199; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 494 420 172781396 964894712 801614770 669328391 245529882 323143330 32420191 468053924 190485210 351950645 480437068 27646427 989413714 1932884 932259996 700362557 559866324 464348045 403772706 792655546 739707869 614957947 368233864 277443219 344493200 40337845 749396548 554362870 821886419 505411160 621579648 457782680 253298402 -159665 885585330 968302328 775081839 275515479 290470581 686314929 172763398 821247587 391213899 29944927 452648255 230583871 431874694 794065209 947344740 781734013 612071104 223937113 620700056 829103023 451413166 957884292 464034795 760958460 473898772 506496415 316455809 547537430 765420493 735632173 349706925 709342734 18155279 220915678 351913065 401928135 300185202 54157672 540342106 288018770 928223545 834427504 673744539 168221120 682265656 878850169 64…
Output: 214005596566

Example 2:

Input: 1336 907 848767678 94687753 71256551 468825490 445031018 589065101 622371569 51424818 617367384 998576168 71558592 548256182 60781900 482800242 95421220 734513816 777641634 821167451 181213183 939881449 679475273 629335081 39442299 477332307 772265157 723250692 267282476 603398103 123306698 943967192 918765094 665687988 449439817 714716234 623652466 78552793 784004858 527672556 365140739 686471026 808950420 953265091 418358751 35773492 258564293 526637120 400871386 221666608 434529448 467022626 86924921 648597961 363275692 96011396 100694970 134615327 588029315 718062856 179778745 622706073 936733721 763809523 292012017 920506988 976408481 80135895 995606778 992802594 899337624 259639998 501226750 846970137 388581180 493882097 696041303 156790275 67573159 208245759 810761310 189569998 9844…
Output: 443757394084

Example 3:

Input: 1954 779 2396357 483365288 834105519 747552205 981902391 549652479 519289802 125929621 561890166 74649040 138051119 84897342 867895146 124138318 653433927 525450344 547630490 884824746 953740487 87518575 93145914 129141190 733253270 919372902 201195549 322468630 349435260 911442498 959988971 752547350 603549495 311729483 729635181 680709948 514244354 644377677 263539019 781653141 849639301 992036424 763826674 471819216 273302724 119498685 55468605 926406156 382127809 656995188 838250055 748058919 17417470 491267252 910456995 205917558 57905510 152599949 -132817 707030152 20018381 386892636 95108593 848418010 723362120 545207816 431359373 556416940 766811181 995054891 972480604 410347564 765007687 284292716 409929147 449705845 814144227 814184991 603470910 773994923 163708561 225397019 8429…
Output: 381013052708

Constraints:

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

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