Codeforces Round 274 (Div. 2)
D
Long Jumps
Codeforces
1700
原题
← CE →
翻译中…

Valery is a PE teacher at a school in Berland. Soon the students are going to take a test in long jumps, and Valery has lost his favorite ruler!

翻译中…

However, there is no reason for disappointment, as Valery has found another ruler, its length is $*l*$ centimeters. The ruler already has $*n*$ marks, with which he can make measurements. We assume that the marks are numbered from 1 to $*n*$ in the order they appear from the beginning of the ruler to its end. The first point coincides with the beginning of the ruler and represents the origin. The last mark coincides with the end of the ruler, at distance $*l*$ from the origin. This ruler can be repesented by an increasing sequence $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$, where $*a*_{*i*}$ denotes the distance of the $*i*$-th mark from the origin ($*a*_{1} = 0$, $*a*_{*n*} = *l*$).

翻译中…

Valery believes that with a ruler he can measure the distance of $*d*$ centimeters, if there is a pair of integers $*i*$ and $*j*$ ($1 ≤ *i* ≤ *j* ≤ *n*$), such that the distance between the $*i*$-th and the $*j*$-th mark is exactly equal to $*d*$ (in other words, $*a*_{*j*} - *a*_{*i*} = *d*$).

翻译中…

Under the rules, the girls should be able to jump at least $*x*$ centimeters, and the boys should be able to jump at least $*y*$ ($*x* < *y*$) centimeters. To test the children's abilities, Valery needs a ruler to measure each of the distances $*x*$ and $*y*$.

翻译中…

Your task is to determine what is the minimum number of additional marks you need to add on the ruler so that they can be used to measure the distances $*x*$ and $*y*$. Valery can add the marks at any integer non-negative distance from the origin not exceeding the length of the ruler.

翻译中…

Input

翻译中…

The first line contains four positive space-separated integers $*n*$, $*l*$, $*x*$, $*y*$ ($2 ≤ *n* ≤ 10^{5}$, $2 ≤ *l* ≤ 10^{9}$, $1 ≤ *x* < *y* ≤ *l*$) — the number of marks, the length of the ruler and the jump norms for girls and boys, correspondingly.

翻译中…

The second line contains a sequence of $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ ($0 = *a*_{1} < *a*_{2} < ... < *a*_{*n*} = *l*$), where $*a*_{*i*}$ shows the distance from the $*i*$-th mark to the origin.

翻译中…

Output

翻译中…

In the first line print a single non-negative integer $*v*$ — the minimum number of marks that you need to add on the ruler.

翻译中…

In the second line print $*v*$ space-separated integers $*p*_{1}, *p*_{2}, ..., *p*_{*v*}$ ($0 ≤ *p*_{*i*} ≤ *l*$). Number $*p*_{*i*}$ means that the $*i*$-th mark should be at the distance of $*p*_{*i*}$ centimeters from the origin. Print the marks in any order. If there are multiple solutions, print any of them.

翻译中…

Note

翻译中…

In the first sample it is impossible to initially measure the distance of $230$ centimeters. For that it is enough to add a $20$ centimeter mark or a $230$ centimeter mark.

翻译中…

In the second sample you already can use the ruler to measure the distances of $185$ and $230$ centimeters, so you don't have to add new marks.

翻译中…

In the third sample the ruler only contains the initial and the final marks. We will need to add two marks to be able to test the children's skills.

翻译中…

样例

Input #1
3 250 185 230
0 185 250
Output #1
1
230
InputCopy OutputCopy
Input #2
4 250 185 230
0 20 185 250
Output #2
0
InputCopy OutputCopy
Input #3
2 300 185 230
0 300
Output #3
2
185 230
InputCopy OutputCopy
题目信息
题号
479D
时间限制
1 s
内存限制
256 MB
标签
二分
贪心
模拟

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。