QOJ.ac

QOJ

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

#21000. למה הפרה חצתה את הכביש III

الإحصائيات

Farmer John הזקן נעשה רגזן ופרנואידי. שכח איך גיוון הפרות שגשג את המשק שנים, בונה גדר ענקית למנוע ביקורי שכנות ואוסר לחלוטין כניסה מכמה משקים. הפרות עצובות: בלי חברות וביטול אולימפיאדת החליבה הבינלאומית שציפו לה כל השנה.

גם מורשות מתקשות: שער יחיד עם תשאול קשה לכל אחת יוצר תור ארוך.

ל־$N$ מבקרות ידועים זמן הגעה ומשך תשובות. אחת בכל רגע, קרובות ממתינות ברצף. הגעה5 ומשך7 מחייבת הגעה8 לחכות12.

מצאו זמן מוקדם לכניסת כולן.

קלט

שורה ראשונה $N$, שלם חיובי עד100. אחר $N$ שורות הגעה ומשך, כל חיובי עד1,000,000.

פלט

זמן מינימלי לסיום כולן.

דוגמאות

קלט 1

3
2 1
8 3
5 7

פלט 1

15

הערה

ראשונה מגיעה2 ומטופלת מהר, שער פנוי עד שלישית5. שנייה מגיעה8, מחכה $5+7=12$, מסיימת $12+3 = 15$.

מחבר הבעיה: 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.