A701 | [USACO 2014 December Gold]Cow Jog
来源USACO / 2014
时间限制1s
内存限制128MB
通过 / 提交0/0
题目描述
Farmer John's N cows (1 <= N <= 100,000) are out exercising their
hooves again, jogging along an infinite track. Each cow starts at a
distinct position on the track, and some cows run at different speeds.
The track is divided into lanes so that cows may move past each other.
No two cows in the same lane may ever occupy the same position.
Farmer John doesn't want any cow to have to change lanes or adjust
speed, and he wonders how many lanes he will need to accomplish this
if the cows are going to run for T minutes (1 <= T <= 1,000,000,000).
Farmer John 的 $N$ 头奶牛 $(1 \le N \le 10^5)$ 正在一条长度无限的跑道上慢跑,每一头奶牛起始的位置不同,跑步的速度也不同。
为了方便奶牛们互相超越,整个跑道被分成了若干条赛道。同一时刻,在同一条赛道上的两头奶牛不可能占据相同的位置。
现在奶牛要跑 $T$ 分钟$(1 \le T \le 10^9)$,在跑步的过程中,奶牛不会改变自己所在的赛道和跑步的速度。FJ想知道,为了使奶牛不发生冲突,他需要至少准备多少条赛道。
hooves again, jogging along an infinite track. Each cow starts at a
distinct position on the track, and some cows run at different speeds.
The track is divided into lanes so that cows may move past each other.
No two cows in the same lane may ever occupy the same position.
Farmer John doesn't want any cow to have to change lanes or adjust
speed, and he wonders how many lanes he will need to accomplish this
if the cows are going to run for T minutes (1 <= T <= 1,000,000,000).
Farmer John 的 $N$ 头奶牛 $(1 \le N \le 10^5)$ 正在一条长度无限的跑道上慢跑,每一头奶牛起始的位置不同,跑步的速度也不同。
为了方便奶牛们互相超越,整个跑道被分成了若干条赛道。同一时刻,在同一条赛道上的两头奶牛不可能占据相同的位置。
现在奶牛要跑 $T$ 分钟$(1 \le T \le 10^9)$,在跑步的过程中,奶牛不会改变自己所在的赛道和跑步的速度。FJ想知道,为了使奶牛不发生冲突,他需要至少准备多少条赛道。
输入格式
The first line of input contains N and T.
The following N lines each contain the initial position and speed of a
single cow. Position is a nonnegative integer and speed is a positive
integer; both numbers are at most 1 billion. All cows start at
distinct positions, and these will be given in increasing order in the
input.
第一行包含两个整数 $N$ 和 $T$ 。
接下来 $ N $ 行,每行两个整数 $p_i$ 和 $v_i$ ($p_i$ ,$v_i$≤ $10^9$),分别代表奶牛的初始位置和速度。保证了初始位置不相同且为升序排列。
The following N lines each contain the initial position and speed of a
single cow. Position is a nonnegative integer and speed is a positive
integer; both numbers are at most 1 billion. All cows start at
distinct positions, and these will be given in increasing order in the
input.
第一行包含两个整数 $N$ 和 $T$ 。
接下来 $ N $ 行,每行两个整数 $p_i$ 和 $v_i$ ($p_i$ ,$v_i$≤ $10^9$),分别代表奶牛的初始位置和速度。保证了初始位置不相同且为升序排列。
输出格式
A single integer indicating the minimum number of lanes necessary so
that no two cows in the same lane ever occupy the same location
(including at time T).
一个整数,表示所需的最小赛道数。
that no two cows in the same lane ever occupy the same location
(including at time T).
一个整数,表示所需的最小赛道数。
输入输出样例
输入 #1
5 3 0 1 1 2 2 3 3 2 6 1
输出 #1
3
暂无题解
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?