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$)は農場前の道路を暴走しているようですが、実際には最速の牛を決める徒競走をしています。

上から見ると各牛は長さ 1 単位の水平線分で、$t=0$ の左端点で指定されます。例えば $(-3,6)$ なら $(-3,6)$ から $(-2,6)$ の線分です。各牛は右($+x$ 方向)に進み、速さは右に 1 単位進むのにかかる整数時間で指定されます。

牛舎で搾乳せず外で走るのを喜ばない FJ は、競走後に厳しく説教するつもりです。参加者を見つけるため $(0,0)$ に立ち、$+y$ 方向の半直線を見ます。競走中のどこかでその半直線上の最初に見える牛になれば、その牛を見ることができます。視線を横切る間ずっと別の牛が前にいると見えないかもしれません。

競走全体で FJ が見られる牛の頭数を求めてください。

入力

最初の行に $N$ が与えられます。次の $N$ 行の整数 $x$、$y$、$r$ は、$t=0$ の左端点が $(x,y)$ で、$r$ 時間につき 1 距離単位の連続速度で右に進む牛を表します。$x$ は $-1000\ldots-1$、$y$ は $1\ldots1{,}000{,}000$ で衝突防止のため全頭で異なり、$r$ は $1\ldots1{,}000{,}000$ です。

出力

$t=0$ 以降の競走全体で見える頭数を整数 1 つで出力してください。

入出力例

入力 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.