P6332 [COCI 2007/2008 #1] PRINOVA

Description

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

Input Format

The first line contains an integer $n$, indicating the length of the sequence. The second line contains $n$ numbers $p_1,\dots,p_n$, describing this even sequence. The third line contains two integers $A, B$, with the meaning as described in the problem statement.

Output Format

Output one integer in one line, representing your answer. **If there are multiple answers, you may print any one of them. This problem uses SPJ.**

Explanation/Hint

#### Constraints For $100\%$ of the testdata, 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 **Translated from [COCI2007-2008](https://hsin.hr/coci/archive/2007_2008/) [CONTEST #1](https://hsin.hr/coci/archive/2007_2008/contest1_tasks.pdf) *T3 PRINOVA*.** Translated by ChatGPT 5