Prinova
의견: 0
Brojko and Brojana are happily married with \(N\) little boys. The boys are named with distinct even integers \(P_1, P_2, \ldots, P_N\).
Brojko and Brojana are expecting an addition to their family and have to come up with a nice name for the little girl. They have decided that the name will be an odd integer in the range \([A, B]\). Because they find all integers in that range equally beautiful, they have decided to choose the number which maximizes the distance to the name of the closest of the \(N\) boys.
More precisely, they seek an odd integer \(X \in [A, B]\) such that the expression
$$ \min\{\,|X - P_i| : i \in [1, N]\,\} $$
is as large as possible.
Write a program that determines the name for the little girl. If there are multiple solutions, output any of them.
The first line contains an integer \(N\) (\(1 \le N \le 100\)), the number of boys.
The second line contains \(N\) distinct even integers, the names of the boys. The integers will be less than \(10^9\).
The third line contains the integers \(A\) and \(B\) (\(1 \le A < B \le 10^9\)), the range of names they are considering for the girl.
Output an integer, the name for the little girl.
| 서브태스크 | 점수 | 설명 |
|---|---|---|
Subtask 1 | 30점 |
3
2 6 16
20 50493
2 6 16
3 15113
2 6 16
1 75평가 및 의견
Prinova
Log in to rate problems.
아직 의견이 없습니다. 자격이 된다면 위 양식에서 가장 먼저 평가해 보세요.
풀이 제출
Prinova