logo AlgoBeat OnlineJudge
登录 注册

#202147. [USACO13NOV] Crowded Cows S

内存限制:125 MiB 时间限制:1000 ms 标准输入输出
题目类型:VJudge(洛谷) 评测方式:VJudge
上传者: 匿名

题目描述

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.

样例

样例输入 1

6 4 
10 3 
6 2 
5 3 
9 7 
3 6 
11 2 

样例输出 1

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.