CT39791

Gardener and the Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

In the indigo vats of Bluehollow, Gardener the archivist keeps careful count of the panels. Prepare the winter inventory, every figure matters. 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 <= 2695; 1 <= a[i] <= 1000000000.

Example 1:

Input: 1187 968 125760985 723608197 17883346 605229222 904479769 482605551 509946278 190378783 67388377 143613141 785735631 382563835 810160177 193129916 844553617 439474552 550085226 454452155 361155752 644767337 299754702 153691839 429912523 845842628 302250520 184952241 274941081 928828653 79969578 434743376 203781754 85233573 347503541 340673435 900865473 753817350 5878083 127268169 344817564 388213186 536456831 14642711 594791713 540048783 606615214 7802143 793496929 378213245 8168255 98093977 687754715 84288702 426937742 493728772 79389084 753409296 315141715 174687138 263202048 765476347 971319591 493296001 795331915 291100441 348540078 285847662 46420160 537729968 823827662 335113473 993421449 625813503 17956829 926616477 86821872 707062891 497545307 25938616 119792920 421884811 116073707…
Output: 473267827085

Example 2:

Input: 931 841 227555717 305732629 761456 231320571 712469817 181186658 319106653 804336845 526528888 34215208 23185036 382343002 908893399 786003507 338397719 976362315 504173410 440260663 924762492 153651050 341255284 266737611 309472461 398776127 987524953 783367094 95040891 749977623 924538593 533233857 973202935 854694256 143783502 267826588 133996900 156437393 998397328 449149397 585144787 287664981 497954890 223527521 383794350 248919168 78824007 4253630 715606936 644893896 465210624 462451289 11225153 347258750 926281767 192874048 988316922 183433420 885666546 661653067 733072121 705384234 151583366 874828125 58871414 495472830 521874038 920093344 103283432 333717369 442713434 344873817 747721412 365441663 584200736 701458550 369038744 239238533 5602410 498770757 203038944 804452971 76145…
Output: 434043144390

Example 3:

Input: 551 528 534147692 7604950 455469570 107360731 597430166 629351681 21710768 649241261 537741465 435593108 25669182 364302393 890002521 355108039 45541136 936760984 691949422 713043405 487035203 299518174 306222750 877734286 62522335 304666521 707540537 490388880 362072251 404448644 169398265 388062653 888342256 983620535 223886087 689444919 110590717 563702160 426238725 45568196 106228385 593245668 65037402 462679853 652845474 375632420 376243545 778790096 819281834 463523313 559043384 535017089 601901773 386800388 341096159 350097755 262733384 669321471 923752857 681765373 628194334 416223762 711750189 57561188 422179678 813527645 468486760 875351424 738966172 131286204 373420096 96140630 581317595 418331412 761486333 872783256 260657286 531499301 369170965 585618839 738433075 242469471 98…
Output: 256648133557

Constraints:

1 <= k <= n <= 2695; 1 <= a[i] <= 1000000000.

Loading...
Test Cases:No test cases
No test cases available.
Gardener and the Calm Window - MEDIUM Coding Problem | CodeTikki