CT56087

The Amber Calm Window

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

Every season at the cinnabar mines of Vermilion, someone must outscore the rival chapter. This year the task falls to Tomas, armed only with the scrolls 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 <= 1217; 1 <= a[i] <= 1000000.

Example 1:

Input: 985 264 160052 679076 744009 567051 442972 313677 621638 204452 400252 963822 567365 383380 263881 843688 442120 710006 215186 585273 241886 718998 450676 931670 926102 602905 261399 94069 959012 465597 398827 590892 402509 552922 886785 98355 91295 471827 204418 839839 647444 169193 608310 224875 313471 511386 645059 979435 388358 515300 381844 289639 541332 248788 557789 384341 89202 275426 55434 752412 746356 917573 384015 573235 799611 186120 698345 356777 877419 623279 196895 962237 992084 796619 883340 736724 713842 631102 68258 551219 414805 779052 514794 179361 118692 588261 791078 123947 613770 444955 746124 739421 928356 550763 721657 567780 108186 426930 897382 631820 750475 536898 706138 420682 762018 490284 363304 336097 944250 960433 269745 428947 240361 315385 758343 488058 …
Output: 124720537

Example 2:

Input: 1145 99 554683 244761 596433 99505 503687 582592 425645 66414 258884 620752 248535 160872 634677 943982 271785 816950 462708 71901 203673 948489 543318 424242 673206 329244 893942 653129 444484 670422 180854 123532 116664 928880 798471 941597 842951 973802 365781 640058 398375 129061 205282 912319 613089 752652 31129 425450 309982 237862 198515 416900 609260 73837 13824 533608 567844 975044 985589 990791 404075 957094 180829 929418 330440 126625 283697 460693 802995 381451 754904 628987 340872 842282 899589 747421 460484 898113 108985 950402 500116 174119 427571 876459 21853 982214 41612 964327 727911 169393 708696 388716 850639 196213 855040 399202 446456 250160 742131 138120 544284 472920 257595 200379 790259 530881 389767 578099 970636 781540 204372 323598 197158 454899 419528 777098 31…
Output: 42855926

Example 3:

Input: 555 471 189430 93843 273114 428893 166769 841976 496377 92744 263617 566851 492560 551351 248201 883136 747534 236482 116365 335517 853833 524817 811953 190347 689073 563561 576584 639316 752802 413704 649326 405257 769230 670605 566238 424821 812065 73400 340723 906558 288542 655800 863955 353451 848562 26581 280885 30950 870684 812951 690688 485190 159452 785102 471487 183949 585023 231197 43166 621762 773232 786085 475510 482716 556035 650775 179219 76191 681802 453447 305436 730224 684885 57061 756636 537826 265101 386196 146772 799124 583898 120262 895277 526896 742876 465563 217559 65647 321417 225297 983769 273906 350099 325194 295102 952125 707227 341607 293178 265602 199886 424143 977960 156344 161518 284427 169758 733818 186732 862118 815931 768867 921461 453802 279594 581428 164…
Output: 229166066

Constraints:

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

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