[USACO13NOV] Crowded Cows S
该比赛已结束,您无法在比赛模式下递交该题目。您可以点击“在题库中打开”以普通模式查看和递交本题。
题目描述
Farmer John's cows () are grazing along a one-dimensional fence. Cow is standing at location and has height ().
A cow feels "crowded" if there is another cow at least twice her height within distance on her left, and also another cow at least twice her height within distance on her right (). Since crowded cows produce less milk, Farmer John would like to count the number of such cows. Please help him.
输入格式
-
Line : Two integers, and .
-
Lines : Line contains the integers and . The locations of all cows are distinct.
输出格式
- Line : The number of crowded cows.
6 4
10 3
6 2
5 3
9 7
3 6
11 2
2
提示
There are cows, with a distance threshold of for feeling crowded. Cow #1 lives at position and has height , and so on.
The cows at positions and are both crowded.