Skip to main content
Tuesday (24.11.2026) at 20:00: ALGOR Contest: Round #4 (Special Challenge) starts!

~/algor $ cat problems/minmax-15-oraliqdagi-eng-katta-son

Largest number in an interval

Easy 1000 ms 256 MB 30%
Share

A positive integer $N$, two integers $B$ and $C$ ($B \lt C$) and $N$ integers are given. Among the numbers strictly inside the interval $(B, C)$, find the largest one and the position of its first occurrence (if there is no such number, print 0 0).

Finding the largest element lying in a given interval

Input

The first line contains three integers: $N$, $B$ and $C$. The next line contains $N$ integers $A_{i}$.

Output

One line with two integers separated by a space: the largest number in the interval and its position (if there is none — 0 0).

Note

$1 \le N \le 1000$
$-10^{9} \le B \lt C \le 10^{9}$
$-10^{9} \le A_{i} \le 10^{9}$

Examples

Input #1
5 2 8
1 5 7 4 9
Output #1
7 3
Input #2
4 10 20
5 8 22 25
Output #2
0 0

Sign in to submit a solution

Signing up is free and takes a minute.