CT35820

The segments at Glowfen

MediumL5 · Recursion RenegadeAcceptance: 0.0%XP: 60

The council of the lantern district of Glowfen pays by the answer, and Tanner intends to earn it. First: the full register of segments. 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 <= 2001; -1000000 <= a[i] <= 1000000000.

Example 1:

Input: 1863 770 54937513 621317721 531647834 366829153 748535654 779895711 920376155 276525223 39274786 732810919 451631831 659243664 229553811 924829501 134749134 872603257 281484167 447444627 319615499 711532455 629994422 858942066 997251293 133023815 526872307 790083755 645635499 198911914 597329069 998588957 172353726 892064005 894020180 412311745 191724812 523270560 579576290 447266670 10080640 274976576 32750030 879702607 358918763 420600639 299356295 994064093 575945309 786486326 420203247 15517520 295469549 101492327 539723611 48496337 392984218 80362565 784375453 220030342 18268976 473960471 841950496 568694319 111251653 369867727 811931312 618174147 229078744 54496355 958033792 580206499 175940116 376742408 909350079 693149619 336536593 689830118 795109887 998373465 361143137 110364135 …
Output: 363069042464

Example 2:

Input: 40 33 399313391 383577785 466072618 642971592 902184318 181064739 313586306 199249667 877647856 510751729 92028815 792759083 812559671 697142850 933310051 450758507 188480022 94372929 304993886 922603872 550899148 257244404 669464137 487939989 757903171 567603755 368714522 359154699 986266635 974401516 612441523 50200113 921598413 378259483 799005162 974047923 972790201 790787516 121111041 748040576
Output: 17708207804

Example 3:

Input: 1596 937 197390354 356596401 600553972 124886918 175743859 933879985 809369055 511237277 912011190 292175507 864208818 630513461 353561028 342081539 265682928 829876653 650333132 64155116 716724701 900634634 142889369 669252369 991151118 981879575 724235267 453942373 962589199 439286326 487617282 446632608 737640718 86897717 581376967 921729091 259472329 813523456 3246390 843157001 885313307 252278414 221731757 187408449 981163017 854156344 549449425 574543749 999119798 970177989 821008966 932146280 383606803 583182223 928047625 569851841 299134908 507664329 676406356 731580143 23426470 670909850 237260729 852174797 747829793 163017175 376619491 826366074 162044307 738709130 829286144 275432023 25301610 57115056 640741700 460376194 735355158 451265162 35519348 901414522 92771218 929944709 …
Output: 456286797966

Constraints:

1 <= k <= n <= 2001; -1000000 <= a[i] <= 1000000000.

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