P29343 [洛谷] [COCI2007-2008#1] PRINOVA
入门
题目描述

Problem Description

Given an even sequence of length $n$, denoted as $p_1, \dots, p_n$, and two integers $A$ and $B$, you are asked to find an odd number $X \in [A, B]$ such that $\min{\{|X - p_i|\}}$ is maximized.

Input Format

The first line of input contains an integer $n$, representing the length of the sequence.

The second line contains $n$ numbers $p_1, \dots, p_n$, describing the even sequence.

The third line contains two integers $A$ and $B$, as described in the problem statement.

Output Format

Output a single integer, which is your answer.

If there are multiple answers, any one of them will be accepted, as this problem uses a special judge.

Sample Input and Output

Sample Input #1

3
2 6 16
20 50

Sample Output #1

49

Sample Input #2

3
2 6 16
3 15

Sample Output #2

11

Sample Input #3

3
2 6 16
1 7

Sample Output #3

5

Notes

Data Size and Constraints

For $100\%$ of the data, it is guaranteed that $1 \le n \le 100$, $2 \le p_i \le 10^9$, and $1 \le A, B \le 10^9$.

Notes

This problem is translated from COCI2007-2008 CONTEST #1 T3 PRINOVA

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 2 6 16 20 50
样例输出
49