- محدودیت زمان: ۱ ثانیه
- محدودیت حافظه: ۲۵۶ مگابایت
T-net which is a new telecommunications company, plans to install its base stations in the city. The places where base stations must be installed have been already specified. T-net has two types of antennas to be used in the base stations: (i) antennas with transmission radius $a$, and (ii) antennas with transmission radius $b$. Two antennas can communicate with each other if and only if both are inside the coverage area of each other. Antenna with smaller transmission radius of course is cheaper. T-net plans to minimize its cost while keeping the whole network connected. Precisely, T-net plans to minimize its cost which is the sum of the transmission radii of all antennas. Interestingly, all base-station places are on a line. Help T-net construct a connected network with the minimum cost.
ورودی
The first line of the input contains three positive integers $n, a$ and $b$ ($1 \leq n \leq 10^5$ and $1 \leq a, b \leq 10^5$) where $n$ is the number of base stations, and $a$ and $b$ are radii as defined in the problem statement. The second line contains $n$ distinct coordinates of base stations on the line with respect to an origin on the line. All coordinates are positive integers not more than $10^5$.
خروجی
If it is possible to construct a connected network, print the minimum cost in the output. Otherwise, print -1
.
مثال
ورودی نمونه ۱
3 1 3
1 4 3
خروجی نمونه ۱
7
ارسال پاسخ برای این سؤال