A618.[USACO 2014 December Gold]Cow Jog

提高+/省选-

USACO

通过率:0%

时间限制:1.00s

内存限制:128MB

题目描述

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 的 NN 头奶牛 (1N105)(1 \le N \le 10^5) 正在一条长度无限的跑道上慢跑,每一头奶牛起始的位置不同,跑步的速度也不同。

为了方便奶牛们互相超越,整个跑道被分成了若干条赛道。同一时刻,在同一条赛道上的两头奶牛不可能占据相同的位置。

现在奶牛要跑 TT 分钟(1T109)(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.

第一行包含两个整数 NNTT

接下来 $ N $ 行,每行两个整数 pip_iviv_i (pip_i ,viv_i10910^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).

一个整数,表示所需的最小赛道数。

输入输出样例

  • 输入#1

    5 3
    0 1
    1 2
    2 3
    3 2
    6 1

    输出#1

    3
首页