Problem list
Log in
#r03215 · Online Judge > GoldOJ

Paired Up

Gold V 2.0 s 256 MB

Each input line x y means there are $x$ cows producing $y$ milk each. Split all the cows into pairs so that the largest pair total ($A + B$) is as small as possible, and print that minimum possible maximum. (Sort all outputs and pair the smallest with the largest.)

Input

Line 1: $N$ groups. Next $N$ lines: x y (the total number of cows is even).

Output

Print the minimum possible largest pair sum.

Example 1

Input
3
1 8
2 5
1 2
Output
10
Source
Online Judge > GoldOJ
Appears in
Not part of a ladder, contest or set yet.
Accepted 0 Submissions 0 Acceptance 0% Solvers 0

Discussion

Threads about this problem. Spoilers are collapsed; wrap hints in ||double bars||.

No discussion yet. Start a thread if something here needs explaining.

Recent submissions Open with filters
Code