PRINOVA
- 시간 제한
- 1s
- 메모리 제한
- 32MB
- 제출
- 0
- 정답
- 0
- 맞힌 사람
- 0
- 정답 비율
- 0.0%
문제
Brojko and Brojana are happily married with N little boys. The boys are named with distinct even integers P1, P2, ..., PN. 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 [ ] B A X , ∈ such that the expression [ ] { } N i P X i ,1 , min ∈ −
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 ≤ N ≤ 100), the number of boys. The second line contains N distinct even integers, the names of the boys. The integers will be less than 109. The third line contains the integers A and B (1 ≤ A < B ≤ 109), the range of names they are considering for the girl.
출력
Output an integer, the name for the little girl.
예제 입력 1
3
2 6 16
20 50
예제 출력 1
49
예제 입력 2
3
2 6 16
3 15
예제 출력 2
11
예제 입력 3
3
2 6 16
1 7
예제 출력 3
5
코드를 제출하려면 로그인이 필요합니다.
로그인제출 내역이 없습니다.
아직 맞은 사람이 없습니다.
제출 내역이 없습니다.