atcoder#AGC032E. [AGC032E] Modulo Pairing
[AGC032E] Modulo Pairing
Score : points
Problem Statement
Let be a positive integer.
You are given integers , where for each .
Consider dividing the integers into pairs. Here, each integer must belong to exactly one pair.
We define the ugliness of a pair as . Let be the largest ugliness of the pairs. Find the minimum possible value of .
Constraints
- All values in input are integers.
Input
Input is given from Standard Input in the following format:
Output
Print the minimum possible value of , where is the largest ugliness of the pairs.
3 10
0 2 3 4 5 9
5
One solution is to form pairs and , with ugliness and , respectively.
2 10
1 9 1 9
0
Pairs and should be formed, with ugliness both .