QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#21108. 奶牛慢跑

Statistics

Farmer John 的 $N$ 頭奶牛($1 \leq N \leq 100,000$)又在鍛鍊蹄子,沿無限長跑道慢跑。每頭從不同位置開始,有些速度不同。

跑道劃分成多條道,奶牛可以互相超越。同道的兩頭奶牛不能在任何時刻位於同一位置。他不希望任何奶牛換道或調整速度,想知道若跑 $T$ 分鐘($1 \leq T \leq 1,000,000,000$),需要多少條道。

輸入格式

第一行含 $N$ 和 $T$。

接下來 $N$ 行各含一頭奶牛的初始位置和速度。位置為非負整數,速度為正整數,兩數都至多 10 億。初始位置互不相同,並按遞增順序給出。

輸出格式

輸出一個整數:保證同道兩頭奶牛從不位於同一位置(包括時刻 $T$)所需的最少道數。

範例

輸入格式 1

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

輸出格式 1

3

題目作者:Mark Gordon,2014

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.