Logo
(追記) (追記ここまで)

27015번 - Turning in Homework 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 1024 MB216525.000%

문제

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.

제한

예제 입력 1

4 10 3
8 9
4 21
3 16
8 12

예제 출력 1

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.

출처

Olympiad > USA Computing Olympiad > 2003-2004 Season > USACO US Open 2004 Contest > Green 4번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /