QOJ.ac

QOJ

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

#21113. דהרה מבוהלת

Statistics

$N$ הפרות של Farmer John ($1 \leq N \leq 50{,}000$) נראות כמסתערות בכביש מול החווה, אך למעשה רצות בתחרות כדי למצוא מי המהירה ביותר.

ממבט על, כל פרה היא קטע אופקי באורך יחידה, המוגדר בקצהו השמאלי בזמן $t=0$. למשל $(-3,6)$ מציין קטע מ-$(-3,6)$ עד $(-2,6)$. כל פרה נעה ימינה (כיוון $+x$), בקצב הניתן כזמן שלם הדרוש להתקדם יחידה.

FJ אינו שמח שהן רצות בחוץ במקום לייצר חלב ברפת, ומתכנן לנזוף בהן בחומרה אחרי המרוץ. כדי לזהות משתתפות הוא עומד ב-$(0,0)$ ומביט לאורך קרן לכיוון $+y$. הוא רואה פרה אם בשלב כלשהו היא הראשונה הנראית על הקרן. היא עלולה לא להיראות אם פרה אחרת לפניה במשך כל חציית קו הראייה.

חשבו כמה פרות הוא יכול לראות במשך המרוץ כולו.

קלט

השורה הראשונה מכילה $N$. $N$ הבאות נותנות שלמים $x$, $y$, $r$: קצה שמאלי $(x,y)$ בזמן $t=0$, תנועה רציפה ימינה יחידת מרחק בכל $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.