CT36700

Sarla and the Wistful windows

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The valuer Sarla has been asked to prepare the guildmaster's brief. On the desk lies a long table of windows readings. 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 <= 2803; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 500 232 483218831 111708348 220318088 15729035 594633299 986955412 117516250 603231487 193274621 323764601 151204965 453393578 917473897 636393576 893154346 872626400 854574101 296164908 500128698 214021102 159844355 635439192 630470590 617320558 587500041 460320880 654111691 150642520 238413586 700796698 48141648 252256209 468934312 725767610 636024998 67952295 690208794 472991748 741019375 468655637 26902508 937234027 977153284 911529710 191336385 94214837 754135555 700939464 452245134 555033341 126878943 309100611 358440450 268710280 580264903 220406125 523916036 966262201 930318429 28879760 406305334 1339859 787067943 989784869 251756645 943182074 648008935 106609173 413073567 577850297 524477644 972360393 192715531 213946804 517954566 510255801 70132146 641986074 924661222 573255834 7…
Output: 113471607533

Example 2:

Input: 2010 366 214742203 804274777 525666305 582914932 324195415 665053937 730803902 502969125 102987007 497550947 192391440 250755871 14430496 696438965 100503703 30909890 341567856 922288509 931704701 913686367 44569239 427690921 692291784 804674884 572117681 145567701 230215828 597191273 231423170 166668209 418453103 664508495 830575686 880718151 566651314 600193805 483096023 388684877 873795657 682679918 738087199 687609364 299375561 416120450 774798167 692663282 350715137 560094587 364472559 851275978 170668536 181808489 622402595 592610655 700151342 998684422 834298105 111881443 801218715 705671891 219464497 135555709 695590535 984511268 26549048 632220923 505499130 550844175 691241646 787708208 725034713 777665593 484281552 116221497 626831776 326585048 986376103 157365926 294914810 44847…
Output: 170743075193

Example 3:

Input: 2168 517 726297670 937665701 594408509 976831835 29510307 685554399 153923198 396193252 622666955 145776159 522493889 176448013 362515967 787882588 407679853 882521503 385779861 23619908 870269805 612045366 253510876 44837309 958635611 970431014 860947171 335713963 563461316 681841092 706363043 17603454 886599395 638042578 830441976 864245372 478694713 21928421 694213625 143655791 461034141 680055834 944781169 934662340 22726181 516874956 533775901 109800953 388511027 767637126 894320169 582659480 647207147 537808200 605924914 180236581 527822856 309366874 86550690 222452541 876636043 845186634 199999875 572152009 343852115 624365139 499009856 216783267 46116353 564978044 964453828 536268884 302325121 460676190 396697081 724551147 324600555 796399129 84636736 930966991 469182986 236780632 …
Output: 241634819519

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Sarla and the Wistful windows - MEDIUM Coding Problem | CodeTikki