cswork / OA打开练习工作台

Akuna CapitalOA #1

Network Formation

估计中等可在线判题

考点(AI 标注)贪心调度双指针滑窗

Form networks from several non-overlapping contiguous ranges of computers, in the original order. Each network must contain at least minComps computers and have a total speed of at least speedThreshold; computers not used in any network may be skipped. Find the maximum number of networks. Speeds are non-negative integers.

输入格式

The first line contains n, minComps and speedThreshold; the second line contains n non-negative integers speed[i]. Site ranges: 1≤n≤200000, 1≤minComps≤n, 0≤speed[i]≤10^9, 0≤speedThreshold≤10^14.

输出格式

Output the maximum number of networks that can be formed.

样例 1

输入:

6 2 15
5 7 9 12 10 13

输出:

2

样例 2

输入:

1 1 1
1

输出:

1

样例 3

输入:

3 2 1
0 0 0

输出:

0