CT39164

The windows at Thornveld

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Wren runs the aviary at the acacia flats of Thornveld. Today the books show a list of windows, and the numbers must be worked out before sundown. 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 <= 1023; 0 <= a[i] <= 1000000000.

Example 1:

Input: 44 41 489605242 391064613 751598249 962690290 649550157 434722914 565808038 698759118 856371459 485600446 575990014 290097511 104415901 786635431 582748620 538012450 66586872 96032940 888612386 101986485 280590305 588410772 438220953 194152126 935037633 811800454 852610996 264565892 446916215 970930511 572518789 970430281 332253720 542461199 624844323 722445704 485547272 305382063 483477298 877352022 648923285 557256030 6170435 516115489
Output: 22113034799

Example 2:

Input: 741 615 995822260 200348927 507472885 579862489 735377568 694999172 104098843 157709472 428191683 738051374 472139464 183570218 958781416 494284995 662869938 285882732 565156325 90566282 570102985 364325660 812934803 992451990 935561708 14776123 416432100 431840257 372533516 530184389 506023869 982260539 176671963 788116605 639163508 998928633 655509941 625792507 877628501 636224612 266142030 402918849 391032425 528800835 151613266 519747856 689440806 847434989 893165155 898659553 224597500 2435340 322977803 264444545 552288802 500318570 757590862 291949140 554402239 902787055 765469930 537769535 923387283 390602738 505140975 693896369 12934326 592301455 767527528 901576452 911930586 442883700 272511939 708800129 972861441 905598699 443703228 674460072 608743465 496390585 89837980 63161751…
Output: 313362722077

Example 3:

Input: 984 525 387620747 109864169 414133510 214417371 696884976 633857521 139226253 612261750 685280606 798423855 797458666 231373461 566499102 94024893 323019285 135330866 920444931 994886151 290287788 540383598 988608088 920662531 836128607 829208480 67047840 994373285 174042615 396604861 930472462 347935044 612012826 812435687 433234981 703752071 224480981 610327306 686721501 638714623 613064484 319344721 37220177 208309040 572173516 350844625 584104383 464780140 14666387 732405081 144504622 906746703 414274783 999004247 759191716 327258124 351033707 731050354 405509778 84024883 518067364 606195526 329108554 21831186 798696396 377242171 380480494 573842075 776270887 109072713 574465545 391538684 775523695 846241119 2599503 782652966 313512820 56508462 309576987 895226032 5544127 423268689 317…
Output: 259528089089

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
The windows at Thornveld - MEDIUM Coding Problem | CodeTikki