QOJ.ac

QOJ

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

#22692. הגשת שיעורי בית

Statistics

Bessie מגישה שיעורי בית של $C$ קורסים ב־Moo U ($1 \le C \le 1{,}000$), כדי להעלות גירה עם חברים בזמן המתנה לאוטובוס הביתה.

מורים מקבלים רק אחרי שיעור, ניקוי לוח, סידור ציוד מעבדה וכו׳. הקלט נותן זמן מוקדם ביותר לקבלה.

מתחילה בקצה מסדרון $H$ מטר ($1 \le H \le 1{,}000$), מרחק $0$, הולכת מטר לשנייה לכיתות בסדר לבחירה. כיתות ודלת לאזור האוטובוסים במסדרון.

בהינתן מיקומי יציאה/כיתות ומועדים, מצאו יציאה מוקדמת ביותר להמתנה. כל המטלות לפני יציאה, הגשה בלי זמן.

קלט

  • שורה 1: שלמים $C$, $H$, $B$. $B$ ($0 \le B \le H$), מרחק מהכניסה להמתנה.
  • שורות $2..C+1$: שני שלמים לכיתת הגשה, ראשון ($0..H$), מטרים מהכניסה, שני ($0..10,000$), שנייה ראשונה לקבלת המורה.

פלט

  • שורה 1: שלם, שנייה מוקדמת ביותר ליציאה להמתנת אוטובוסים.

דוגמאות

קלט 1

4 10 3
8 9
4 21
3 16
8 12

פלט 1

22

הערה

זמן פעולה
$0$ Bessie הולכת לכיתות ב־$8$ מטר (ב־$8$מ׳)
$8$ מחכה$1$ שנייה
$9$ מגישה מטלה ראשונה
$9$ מחכה$3$ שניות, חושבת על חציר קריר בקיץ
$12$ מגישה מטלה אחרת כאן
$12$ חוזרת לכיתה ב־$4$ מטר (ב־$4$מ׳)
$16$ מחכה$5$ שניות, חושבת על שור נאה שפגשה
$21$ מגישה מטלה
$21$ חוזרת לכיתה ב־$1$ מטר (ב־$3$מ׳)
$22$ מגישה מטלה
$22$ יוצאת, כאן גם יציאת האוטובוס

יוצאת ב־$22$, אין סידור טוב יותר.

תודות: Hal Burch, 2004

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.