GNAQ @ 2019-01-07 09:30:43
The cows are out exercising their hooves again! There are
With only one lane in the track, cows cannot pass each other. When a faster cow catches up to another cow, she has to slow down to avoid running into the other cow, becoming part of the same running group.
The cows will run for
Two cows should be considered part of the same group if they are at the same position at the end of T minutes.
奶牛们又在瞎跑了!现在有
请计算
The first line of input contains the two integers
The following
第一行两个以空格分隔的整数
随后的
A single integer indicating how many groups remain after T minutes.
输出一行一个数字表示答案。
5 3
0 1
1 2
2 3
3 2
6 1
3
source:
## 题目描述
The cows are out exercising their hooves again! There are $N \,\,(1 \leqslant N \leqslant 10^5)$ cows jogging on an infinitely-long single-lane track. Each cow starts at a distinct position on the track, and some cows jog at different speeds.
With only one lane in the track, cows cannot pass each other. When a faster cow catches up to another cow, she has to slow down to avoid running into the other cow, becoming part of the same running group.
The cows will run for $T \,\,(1 \leqslant T \leqslant 10^9)$ minutes. Please help Farmer John determine how many groups will be left at this time.
**Two cows should be considered part of the same group if they are at the same position at the end of T minutes.**
奶牛们又在瞎跑了!现在有 $N \,\,(1 \leqslant N \leqslant 10^5)$ 头奶牛在一条无限长的单人跑道上跑步,**每头牛的起点位置都不同**。由于是单人跑道,所以它们之间不能相互超越。当一头速度快的奶牛追上另外一头奶牛的时候,为了避免相撞,它必须降速成同等速度。如此降速之后每一时刻的位置和速度都会相同,把这些牛看成一个小组。
请计算 $T \,\,(1 \leqslant T \leqslant 10^9)$ 个单位时间后,奶牛们将分为多少小组。
## 输入输出格式
### 输入格式:
The first line of input contains the two integers $N$ and $T$.
The following $N$ lines each contain the initial position and speed of a single cow. Position is a **non-negative** integer and speed is a **positive** integer; both numbers are at most $10^9$. **All cows start at distinct positions, and these will be given in increasing order in the input.**
第一行两个以空格分隔的整数 $N$ 和 $T$ 。
随后的 $N$ 行包含每个牛的初始速度和位置。保证位置是**非负整数**,速度是**正整数**。这两个数字都不会超过 $10^9$ 。保证所有牛的初始位置都不相同,**并且这些数据是初始位置为关键字升序的。**
## 输出格式:
A single integer indicating how many groups remain after T minutes.
输出一行一个数字表示答案。
### 说明
$ 1 \leqslant N \leqslant 10^5 $
$ 1 \leqslant T \leqslant 10^9 $
$ 1 \leqslant v_i \leqslant 10^9 $
$ 0 \leqslant p_i \leqslant 10^9 $
by ButterflyDew @ 2019-01-07 10:11:48
资瓷
by __Hacheylight__ @ 2019-01-07 10:25:09
滋滋
by Aehnuwx @ 2019-03-20 20:32:22
@chen_zhe
by CBW2007 @ 2019-04-16 20:32:01
@chen_zhe
by Haishu @ 2019-06-22 13:21:35
@chen_zhe
by Haishu @ 2019-06-22 13:24:56
@GNAQ "初始位置和速度",而不是“初始速度和位置”