CT31187

The Calm Window at Rye Hollow

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Every season at the gristmill of Rye Hollow, someone must rank apprentices for the new term. This year the task falls to Quill, armed only with the stretches register. 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 <= 1632; -1000000 <= a[i] <= 1000000.

Example 1:

Input: 1182 510 144781 -95116 310407 990061 -938187 -588253 374615 -437537 484369 786204 -723509 17772 -47329 483377 -532641 -555303 -374406 -956877 -741696 720059 834009 258218 -77198 -655122 -637206 -513395 -957407 -810413 926727 616341 756834 -605533 726167 -238177 -714108 -456855 -11009 -810050 985912 114480 914962 -402269 950510 946917 464705 -698088 844125 -682106 844669 970942 -430021 410736 745992 -626556 -106881 -517042 -84456 680507 312163 -602731 299846 -150931 -282945 336144 -149818 641915 591512 506707 -253317 914322 655989 -21387 320052 71428 714693 255953 -116019 925499 756311 16219 908741 881446 -884850 -42027 509137 -683513 -753233 -535160 -476798 421719 -324670 754484 -319378 -651649 790594 920510 566573 -237151 -791397 -157970 -834570 -732534 363175 -956844 -704961 -243533 -706…
Output: -31396949

Example 2:

Input: 1470 959 541129 -163645 -336695 161206 -587918 -442904 -16777 575504 562720 -652628 -399519 519665 546050 -826982 -486890 869259 53882 -211450 356679 -241545 -683290 -464499 827478 874340 -647861 418502 -133500 -719145 58061 -695688 565104 600687 -402291 -135052 133646 5274 381573 24337 674181 194665 807163 303517 -46001 -613784 -712748 -125841 -877572 366352 281404 -63362 807112 11963 -622014 -999402 -966698 -228257 437450 82115 770053 98646 -224618 623687 -545999 -108420 615596 -548768 -782003 -348085 -422587 893899 -802043 -334801 254831 557070 56011 -464702 644972 -122949 535300 562366 698342 -389303 -41192 -730830 -167123 17445 584731 -474574 988919 407788 146285 238446 652935 -656944 -215888 464884 -92980 164049 -968785 434766 -591745 -13685 -408155 -213682 402100 -699327 -310636 -83…
Output: -9407091

Example 3:

Input: 1076 445 -669896 732124 -968897 187307 615786 -382219 935409 25349 -708772 -938955 -84663 -614124 -291287 -551880 -276868 118344 -526604 834256 -866228 314841 -240595 -988328 -501002 2881 509645 -985664 794767 337202 899278 105316 -134093 -279136 -766244 399656 -933355 218947 -508888 512424 394362 -767336 563950 319052 917039 -154816 432821 640533 -660394 -406574 550643 671996 175196 10588 -358667 192008 412213 -731491 542424 394777 744339 -253608 275350 -398202 -514562 966710 -373137 10236 -749483 91775 -782336 -415940 -974275 -706706 -358700 433360 702647 -968991 442051 -769985 575323 -703131 537018 -992458 -962876 283009 404775 18148 43679 -505047 -651161 -465135 -962077 54796 -370930 430327 -474162 890852 28771 -462757 -200131 -261130 897170 532896 658949 207411 926092 -162658 -664191 …
Output: -18710941

Constraints:

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

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