#P7542. [COCI 2009/2010 #1] MALI
[COCI 2009/2010 #1] MALI
Description
Mirko and Slavko are playing a game. The game has a total of rounds. In round , Slavko gives two integers and . Please help Mirko solve the following problem:
In the first rounds, Slavko has given the numbers and . Pair these numbers into pairs (), such that every number in sequence and every number in sequence appears exactly once among these pairs, and the maximum value among the sums of all pairs () is minimized.
Input Format
The first line contains an integer , indicating the number of rounds in the game.
The next lines each contain two integers , indicating the two numbers Slavko gives in round .
Output Format
Output lines. The -th line should be the minimum possible maximum pair sum after round .
3
2 8
3 1
1 4
10
10
9
3
1 1
2 2
3 3
2
3
4
Hint
Constraints
For of the testdata, .
For of the testdata, , .
Notes
The scoring of this problem follows the original COCI problem settings, with a full score of .
Translated from COCI2009-2010 CONTEST #1 T4 MALI.
Translated by ChatGPT 5
京公网安备 11011102002149号