-
Notifications
You must be signed in to change notification settings - Fork 0
/
479D.cpp
61 lines (52 loc) · 1.36 KB
/
479D.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
// Rodrigo Farias de Macêdo
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define FOR(i,a,b) for(int i=(a),_b=(b); i<=_b; i++)
#define FORD(i,a,b) for(int i=(a),_b=(b); i>=_b; i--)
#define REP(i,a) for(int i=0,_a=(a); i<_a; i++)
#define EACH(it,a) for(__typeof(a.begin()) it = a.begin(); it != a.end(); ++it)
#define SZ(S) ((int) ((S).size()))
#define DEBUG(x) { cout << #x << " = " << x << endl; }
#define PR(a,n) { cout << #a << " = "; FOR(_,1,n) cout << a[_] << ' '; cout << endl; }
#define PR0(a,n) { cout << #a << " = "; REP(_,n) cout << a[_] << ' '; cout << endl; }
int n, l, x, y, aux, ans;
int A[100009];
map<int, bool> M;
void point(ll val){
if(val < 0 || val>l) return;
if(M[val + y] || M[val-y]){
ans = val; return;
}
}
int main(){
cin >> n >> l >> x >> y;
REP(i, n){
scanf("%d", &A[i]);
M[A[i]] = true;
}
bool X = false, Y=false;
REP(i, n){
X|= M[A[i]+x] || M[A[i]-x];
Y|= M[A[i]+y] || M[A[i]-y];
}
if(X && Y){
printf("0\n"); return 0;
}
if(X || Y){
printf("1\n");
(Y ? printf("%d\n", x) : printf("%d\n", y));
return 0;
}
ans = -1;
REP(i, n){
point(A[i] + x);
point(A[i] - x);
}
if(ans == -1){
printf("2\n%d %d\n", x, y);
}else{
printf("1\n%d\n", ans);
}
return 0;
}