CT34176

Innkeeper's panels Calm Window

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Before the gates of the silver mines of Lodebarrow close for winter, Innkeeper must finish the panels ledger - one figure at a time. 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 <= 1865; 1 <= a[i] <= 1000000.

Example 1:

Input: 646 341 930586 910293 587709 449180 259410 23133 634244 873907 450092 40944 921382 314129 740815 725299 818454 221799 419065 528083 56560 861908 523676 17079 358074 7599 923526 881276 160042 397208 502957 786299 677352 188073 351843 206461 948399 839582 887648 255536 503877 961460 151140 68678 833437 142211 197812 169524 849229 574589 592876 705424 548634 341764 220973 155464 187282 186759 732360 998289 153299 512856 657446 965447 413847 490808 11247 542068 340902 179092 312206 512792 460176 612565 38479 348431 990445 557616 435125 840881 121915 287339 218586 94955 672127 610261 883393 391686 774131 630889 509798 119899 244465 991736 873589 15058 919707 454493 619241 662713 281745 383335 133675 99823 629276 819107 998434 158519 905235 915986 445163 689926 906480 313703 514453 179515 517710…
Output: 174840195

Example 2:

Input: 1488 981 819807 944296 169256 33665 490875 522698 559642 861445 390494 755194 206510 270292 145895 879249 982562 170103 28111 279195 259663 46970 829303 212303 898427 890058 686593 941439 511483 157331 91031 101110 285552 387875 478677 63959 415898 649416 918766 837269 40851 332252 121261 255347 141637 465326 770343 265179 345962 753804 192245 555488 876636 571039 879688 273417 909730 552976 847173 212532 242216 586390 581281 813209 92029 76719 789658 761983 612194 794393 937529 879466 918558 269149 693247 994258 99402 129042 350122 717088 195737 712029 845856 236608 259855 941278 455774 563154 782664 931855 341691 978812 599780 536768 514612 506661 166554 284304 131504 504147 554814 568840 122630 968247 529957 594940 554431 272091 607352 242328 262254 397340 766691 129448 579662 694083 30…
Output: 491225363

Example 3:

Input: 1265 756 652298 763312 300371 644680 118132 49553 425329 405545 126543 638232 120750 362638 995258 64144 19649 595835 840810 872671 843690 345102 814592 520503 592731 83344 88803 60861 62776 18839 802578 143858 631092 971031 428073 232443 453567 477769 846265 442907 273072 500200 696264 794277 945123 120787 660356 514585 893112 197148 434056 956809 230860 498802 457201 481934 178809 45905 935413 30038 505420 577904 510882 656420 189068 835654 355821 366707 827299 927748 617978 259917 409095 913286 160940 947398 389340 934430 606798 321908 682174 194777 151601 896709 508717 386418 990465 503712 266152 703692 268075 260623 804379 525433 578618 928122 273021 667087 784422 586424 428286 299367 496927 171407 478658 510699 96345 934730 905598 553385 411903 527034 491555 34730 241487 913625 96925…
Output: 378919848

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Innkeeper's panels Calm Window - MEDIUM Coding Problem | CodeTikki