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$ 방향 반직선을 본다. 소가 경주 중 한 번이라도 이 반직선에서 가장 먼저 보이는 소라면 볼 수 있다. 시선을 가로지르는 내내 다른 소가 앞에 있으면 보이지 않을 수 있다.

경주 전체에서 볼 수 있는 소의 수를 구하라.

입력

첫 줄에 $N$이 주어진다. 다음 $N$줄은 정수 $x$, $y$, $r$로 $t=0$의 왼쪽 끝점 $(x,y)$와 $r$ 시간마다 한 거리 단위의 연속적인 오른쪽 이동을 나타낸다. $x$는 $-1000\ldots-1$, $y$는 $1\ldots1{,}000{,}000$이며 충돌 방지를 위해 소마다 다르다. $r$는 $1\ldots1{,}000{,}000$이다.

출력

$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.