QOJ.ac

QOJ

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

#22692. 숙제 제출

Statistics

Bessie는 Moo U의 $C$과목($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$m)
$8$ $1$초 기다림
$9$ 첫 숙제 냄
$9$ $3$초 기다리며 여름 시원한 건초 생각
$12$ 이곳 다른 숙제 냄
$12$ 복도$4$미터 교실로 돌아감(위치$4$m)
$16$ $5$초 기다리며 만났던 잘생긴 황소 생각
$21$ 숙제 냄
$21$ 복도$1$미터 교실로 돌아감(위치$3$m)
$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.