当前你的浏览器版本过低,网站已在兼容模式下运行,兼容模式仅提供最小功能支持,网站样式可能显示不正常。
请尽快升级浏览器以体验网站在线编辑、在线运行等功能。

建议使用的浏览器:

谷歌Chrome 火狐Firefox Opera浏览器 微软Edge浏览器 QQ浏览器 360浏览器 傲游浏览器

1991:Turning in Homework

题目描述
Bessie must turn in her homework for her C classes (1 <= C <= 1,000) at Moo U so that she still has time to chew the cud with her fellow classmates as they wait for the bus to go home.

Teachers accept homework submissions only after they have finished their classes and also cleaned the chalkboard, put away lab supplies,and so on. The input data tells the earliest time a teacher will accept homework.

Bessie starts at one end (distance 0) of a hallway H (1 <= H <= 1,000) meters long and walks at the rate of one meter per second to various classrooms (in any order she chooses) to turn in her homework. Each classroom is located along this hallway, as well as the door to the waiting area for the buses.

Given the location of both the exit and the classrooms and also the teachers' schedules, determine the earliest time that Bessie can exit the door to the waiting area for the buses. Bessie must turn in all her homework before exiting. The act of turning in the homework takes no time, by the way.
输入解释
* Line 1: Three integers: C, H, and B. B (0 <= B <= H) is the distance from the hall entrance to the bus waiting area.

* Lines 2..C+1: Each line contains two integers that describe a classroom where homework is to be submitted. The first integer (0..H) is the number of meters to the classroom from the hallway entrance. The second integer (0..10,000) is the first time (in seconds) that the teacher for that course will accept homework.
输出解释
* Line 1: A single integer: the earliest second that Bessie can exit the door to the waiting area for the buses.
输入样例
4 10 3
8 9
4 21
3 16
8 12
输出样例
22
提示
Time   Action

0 Bessie walks to the classrooms 8 meters down the hall (at 8m)
8 Bessie waits 1 second
9 Bessie turns in the first set of homework
9 Bessie waits 3 seconds, thinking about cool hay in the summertime
12 Bessie turns in the other homework for this location
12 Bessie walks back to the classroom 4 meters down the hall (at 4m)
16 Bessie waits 5 seconds, thinking of a handsome bull she once met
21 Bessie turns in her homework
21 Bessie walks back to the classroom 1 meters down the hall (at 3m)
22 Bessie turns in her homework
22 Bessie exits, since this also the location of the bus exit

Thus, Bessie can leave at time 22. No better schedule exists.

该题目是Virtual Judge题目,来自 北京大学POJ

题目来源 USACO 2004 U S Open

源链接: POJ-1991

最后修改于 2020-10-29T06:19:50+00:00 由爬虫自动更新

共提交 0

通过率 --%
时间上限 内存上限
1000 30000