CT31543

Vesper and the Beryl segments

MediumL4 · Loop LordAcceptance: 0.0%XP: 35

Vesper the tallyman watches over the port of Emberfall's stores of segments. 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 <= 2773; 1 <= a[i] <= 1000000.

Example 1:

Input: 1313 1288 584045 304497 210863 622910 211058 692354 30591 884467 248068 441935 797872 139607 72567 753993 667032 472312 297504 379570 986065 290873 177369 736761 268441 745196 993497 73850 38599 799142 252246 353642 808776 155878 64185 325168 234298 812813 448773 400672 837762 550548 35778 847589 105493 810538 368735 800966 203049 85015 268466 795214 752786 342356 366037 675456 490914 458871 393834 94899 624389 861132 163981 89609 679285 100732 219280 192592 211613 328474 360357 90901 784896 963093 449346 307818 97693 4423 857492 825147 664481 795756 872926 931855 103094 145244 495392 205551 421196 144953 693908 28244 619809 523722 507551 192754 138560 133619 195300 978243 10953 574707 473966 829480 862108 515885 724956 625471 933551 375890 720106 4720 265021 630181 115859 505913 334363 65…
Output: 622702988

Example 2:

Input: 926 573 271862 784563 986214 250365 553905 822288 967138 714200 558019 462578 138802 118206 14623 671985 181176 233583 727503 188198 993542 60029 511952 790241 33550 366412 652274 445187 813189 951747 772031 491727 347631 516351 305525 582070 28442 952235 413429 469559 817860 862441 842439 111175 760727 304788 620089 765388 106858 331656 414087 661175 517978 94984 452882 467240 661454 438200 689999 614169 242433 758860 213997 487056 590640 177525 63875 942909 308744 493719 704266 590372 835786 663129 615367 291182 326181 865190 207190 971403 536599 662803 297797 950631 94753 48974 679387 929906 115103 108081 156844 807540 518656 81504 874156 113715 650479 559028 312816 554505 311173 373291 789100 26932 4030 890188 731561 1928 746854 441821 698079 749065 494867 203009 567615 65283 946234 13…
Output: 284969819

Example 3:

Input: 1882 614 369055 169455 333084 423008 312654 104588 405516 392172 26471 55259 537980 284616 264376 760778 853994 386567 1598 131415 724620 337001 102169 494236 446378 42352 989090 89107 454234 531120 984691 61190 635841 401014 918639 584212 759402 69908 68958 270450 168021 572263 618650 384459 947868 965115 871298 674157 850899 911986 396602 422501 183110 219091 633658 954595 769896 623793 963254 879753 821733 520559 606739 669963 81399 181502 345684 366446 571796 467911 245294 701253 481578 76036 202761 671368 64680 157076 553988 659557 65227 393221 761292 532435 410052 37453 715513 725563 297277 393371 224947 881627 440058 246231 129095 910130 518639 843968 556978 893186 436047 655692 572878 530874 151222 968374 255395 10146 276141 168179 536725 562302 33681 170367 884577 407484 489334 64…
Output: 288625154

Constraints:

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

Loading...
Test Cases:No test cases
No test cases available.
Vesper and the Beryl segments - MEDIUM Coding Problem | CodeTikki