QOJ.ac

QOJ

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

#21113. 狂奔

Statistics

Farmer John 的 $N$ 頭牛($1 \leq N \leq 50{,}000$)看起來在農場前的路上狂奔,實際上是在賽跑,看看誰最快。

俯視時,每頭牛用長為一個單位的水平線段表示,由 $t=0$ 時左端點座標指定。例如 $(-3,6)$ 表示此時從 $(-3,6)$ 到 $(-2,6)$ 的牛。每頭牛都向右($+x$ 方向)移動,速率以向右移動一個單位所需的整數時間給出。

FJ 不太喜歡牛在外賽跑而不在牛棚產奶,打算賽後嚴厲訓話。為了識別參賽牛,他站在 $(0,0)$,沿 $+y$ 方向的射線觀察。如果一頭牛在賽程中曾是射線上第一頭可見的牛,FJ 就能看見她。也就是說,若牛穿過視線的整個過程都有另一頭牛擋在前面,就可能看不見。

求 FJ 在整場比賽中能看見的牛的數量。

輸入格式

輸入第一行包含 $N$。接下來 $N$ 行每行三個整數 $x$、$y$、$r$,描述 $t=0$ 時左端點為 $(x,y)$ 的牛,以每 $r$ 單位時間一個單位距離的連續速度向右移動。$x$ 的範圍是 $-1000\ldots-1$,$y$ 是 $1\ldots1{,}000{,}000$,且每頭牛的 $y$ 不同以防碰撞;$r$ 為 $1\ldots1{,}000{,}000$。

輸出格式

輸出一個整數,表示 FJ 在整場比賽(從 $t=0$ 開始)中能看見的牛的數量。

範例

輸入格式 1

3
-2 1 3
-3 2 3
-5 100 1

輸出格式 1

2

說明

FJ 能看見牛 $1$、$2$,但看不見牛 $3$。

題目作者:Brian Dean

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.