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.