CT31646

Asha's Calm Window Ledger

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Asha the ledger master watches over the river town of Willowford's stores of stretches. A careful computation stands between order and chaos. 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 <= 3900; 0 <= a[i] <= 1000000.

Example 1:

Input: 1917 1299 317290 814416 698197 479003 418102 533540 682319 369290 821088 583235 785447 293160 264750 307784 505325 218330 954647 910968 583135 744865 564817 411296 566357 924869 910842 714427 630036 729137 111754 979521 991361 260552 811685 51712 512899 970083 987153 609913 602007 306338 761768 894184 970952 234466 769005 544760 118157 575549 953829 809930 822593 171659 667892 748854 830175 430863 960646 232785 277928 462860 279133 593726 700189 863803 281898 427290 935061 811850 854073 34410 790352 537001 236887 542167 912334 994526 956052 780878 556648 449975 221824 54137 743036 74736 369126 108901 137785 263198 471748 946705 23033 844375 275797 140570 877227 843583 813457 200229 868076 805136 854315 11475 764075 403446 134926 555229 638851 457663 436949 116145 431232 481987 874372 50014…
Output: 638984160

Example 2:

Input: 1289 674 548455 910779 493206 501072 369379 700831 165725 645808 758050 149079 285650 132035 952750 850294 208356 964758 375943 205994 885540 185442 268658 773625 362457 753879 230144 224702 128357 299554 880200 714340 62313 62626 440975 892764 704089 189047 548020 773319 968809 403907 412796 795260 238405 341904 434758 25828 169011 256682 253216 587142 148222 189876 115291 427840 505215 22913 535957 92197 40573 873152 162133 610142 264236 474906 794674 715526 225205 260436 180270 654159 299845 861247 335910 495134 695242 819134 716889 857277 246268 807994 401249 117271 779845 758490 505047 853138 607937 144387 119122 362438 740150 198554 549618 900825 649170 186958 183360 128756 838834 433838 8590 823375 200603 186511 66804 77830 564002 625061 454228 643852 901137 249540 536602 3890 66507…
Output: 326305663

Example 3:

Input: 3677 3506 428993 593661 741820 684162 619648 168157 57266 885764 350931 812790 769889 373860 987281 306019 667046 429093 273401 543122 947940 291371 830327 93502 354172 917514 704817 303015 826377 417990 575674 251557 10433 514057 985809 864502 178399 677414 705311 631264 644403 878303 895450 823198 389139 312470 371189 621840 431294 858530 218958 614167 894808 275452 111624 481382 904437 580318 346641 244164 124119 244160 988173 954165 482179 128670 802636 950911 631289 69639 172240 731096 686163 700689 98416 877512 250261 551696 813249 946522 745014 270856 566672 505197 646322 286133 285207 385770 842394 193197 793584 259681 929663 938967 488330 245974 983969 822764 231043 185845 205542 871676 880050 377049 936301 485062 531568 675889 227127 58478 553518 664635 799838 308858 537473 59452…
Output: 1766428764

Constraints:

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

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