A. 时空机器(1.6)

    Type: Default 1000ms 128MiB

时空机器(1.6)

You cannot submit for this problem because the contest is ended. You can click "Open in Problem Set" to view this problem in normal mode.

说明

c家所在的街道有n个路口,他家在街道的第一个路口,超市在街道的最后一个路口。小c走路从一个路口到下一个路口,需要花费时间。

c想尽快到达目的地,他决定使用时空机器。使用时空机器可以由第i个路口直接到达第i+k个路口。时空机器只能使用一次,使用时空机器不占用时间。

求小c最快到达超市的时间。

输入格式

第一行,两个正整数nk

第二行,n-1个正整数,第i个数ai表示由路口i走到路口i+1花费的时间。

输出格式

一个正整数。

6 2
3 5 6 3 7
13

提示

数据范围:

60%的数据:1<=k<n<=1000ai<=10000

100%的数据:1<=k<n<=1000000ai<=10^10

来源

尺取法

尺取法

Not Attended
Status
Done
Rule
ACM/ICPC
Problem
2
Start at
2026-1-6 12:00
End at
2026-1-14 20:00
Duration
200 hour(s)
Host
Partic.
29