QOJ.ac

QOJ

Límite de tiempo: 1.0 s Límite de memoria: 2048 MB Puntuación total: 100

#14934. 训练 第四轮

Estadísticas

Ashley 正在 Brandon's Online Judge 上为另一场编程竞赛进行训练。Brandon's Online Judge 仍然具有相同的功能,允许 Ashley 的教练 Tom 为 Ashley 加载一个题单供其练习。

Tom 为 Ashley 挑选了一些题目。每道题都由“代码实现难度”和“思维难度”两个正整数参数来表示。Ashley 必须按顺序解决这些题目。

Ashley 开始时具有一定的代码实现水平和思维水平。当且仅当 Ashley 的代码实现水平大于或等于题目的代码实现难度,且她的思维水平大于或等于题目的思维难度时,她才能解决这道题。在解决一道题后,她的代码实现水平和思维水平中的恰好一个会增加 $1$,且 Ashley 可以选择让哪一个增加。

计算 Ashley 开始时代码实现水平和思维水平之和的最小可能值,使得她能够按顺序解决 Tom 题单上的所有题目。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 50$)。

接下来的 $n$ 行,每行包含两个整数 $i$ 和 $t$ ($1 \le i, t \le 10^9$),分别表示 Tom 题单中某道题的代码实现难度和思维难度。

题目按照 Ashley 必须解决的顺序给出。

输出格式

输出一个整数,表示 Ashley 开始时代码实现水平和思维水平之和的最小可能值,使得她能够按顺序解决 Tom 题单上的所有题目。

样例

输入样例 1

3
4 4
5 1
1 5

输出样例 1

8

输入样例 2

3
4 4
1 6
6 1

输出样例 2

10

输入样例 3

2
33 33
34 34

输出样例 3

67

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.