QOJ.ac

QOJ

حد الوقت: 2 s حد الذاكرة: 256 MB مجموع النقاط: 100

#21113. Fuga precipitosa

الإحصائيات

Le $N$ mucche di Farmer John ($1 \leq N \leq 50{,}000$) sembrano correre in fuga sulla strada davanti alla fattoria, ma in realtà gareggiano per scoprire la più veloce.

Dall’alto ogni mucca è un segmento orizzontale di lunghezza unitaria, dato dall’estremo sinistro a $t=0$. Per esempio, $(-3,6)$ indica il segmento da $(-3,6)$ a $(-2,6)$. Tutte vanno a destra (direzione $+x$), con velocità indicata dal tempo intero per avanzare di un’unità.

FJ non è contento che corrano fuori invece di produrre latte nella stalla e vuole rimproverarle severamente dopo. Per identificare le partecipanti sta in $(0,0)$ e guarda lungo una semiretta verso $+y$. Vede una mucca se è mai la prima visibile sulla semiretta. Può non vederla se un’altra è davanti per tutto il tempo in cui attraversa la linea di vista.

Calcola quante mucche può vedere durante tutta la gara.

Input

La prima riga contiene $N$. Le successive $N$ danno interi $x$, $y$, $r$: estremo sinistro $(x,y)$ a $t=0$, moto continuo a destra di un’unità di distanza ogni $r$ unità di tempo. $x$ è in $-1000\ldots-1$, $y$ in $1\ldots1{,}000{,}000$ (distinto per mucca per evitare collisioni), e $r$ in $1\ldots1{,}000{,}000$.

Output

Un intero: quante mucche sono visibili in tutta la gara a partire da $t=0$.

Esempi

Input 1

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

Output 1

2

Spiegazione

FJ vede le mucche $1$ e $2$, ma non $3$.

Autore del problema: 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.