QOJ.ac

QOJ

Time Limit: 2.5 s Memory Limit: 512 MB Total points: 100

#3070. פולשים מהחלל

Statistics

החייזרים מהחלל החיצון פלשו (סוף סוף!) לכדור הארץ. הגן על עצמך, אחרת תפורק לחלקיקים! או תוטמע בתוכם. או תיאכל. אנחנו עדיין לא בטוחים.

החייזרים פועלים לפי דפוס תקיפה ידוע. יש $n$ תוקפים; התוקף ה-$i$ מופיע בזמן $a_i$, במרחק $d_i$ ממך. יש להשמיד אותו לא יאוחר מהזמן $b_i$, אחרת הוא יירה בנשקו, ובכך בוודאות יסיים את הקרב.

הנשק שלך הוא תותח בעל השפעה אזורית, שאפשר לכוון לכל עוצמה. ירייה בעוצמה $R$ משמידה מיד את כל החייזרים שמרחקם לכל היותר $R$. היא גם צורכת $R$ תאי דלק.

מצא את העלות המזערית (הנמדדת בתאי דלק) להשמדת כל החייזרים בלי להיהרג.

גודל קובץ הקלט אינו עולה על 0.1 MiB.

קלט

השורה הראשונה בקלט מכילה את מספר מקרי הבדיקה $T$. לאחריה מופיעים תיאורי מקרי הבדיקה:

כל מקרה מתחיל בשורה המכילה את מספר החייזרים $n$ ($1 \le n \le 300$). מבין $n$ השורות הבאות, השורה ה-$i$ מכילה שלושה מספרים שלמים $a_i$, $b_i$, $d_i$ ($1 \le a_i < b_i \le 10\,000$; $1 \le d_i \le 10\,000$). החייזר ה-$i$ מופיע בזמן $a_i$, נשאר לא פעיל עד $b_i$, ומרחקו ממך הוא $d_i$.

פלט

לכל מקרה בדיקה הדפס שורה אחת המכילה את מספר התאים המזערי הדרוש להשמדת כל החייזרים.

דוגמאות

קלט 1

1
3
1 4 4
4 7 5
3 4 7

פלט 1

7

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.