题目描述:
 
 
Long Jumps
 

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 nmarks, 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 a1, a2, ..., an, where ai denotes the distance of the i-th mark from the origin (a1 = 0, an = 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, aj - ai = 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 nlxy (2 ≤ n ≤ 105, 2 ≤ l ≤ 109, 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 a1, a2, ..., an (0 = a1 < a2 < ... < an = l), where ai 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 p1, p2, ..., pv (0 ≤ pi ≤ l). Number pi means that the i-th mark should be at the distance of pi centimeters from the origin. Print the marks in any order. If there are multiple solutions, print any of them.

Examples
input
3 250 185 230
0 185 250
output
1
230
input
4 250 185 230
0 20 185 250
output
0
input
2 300 185 230
0 300
output
2
185 230
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.

题目大意:有一把尺子,知道总长度,女生男生跳远的距离x,y(x<y)以及n个已知刻度,问再添加几个刻度才能得到x与y的长度。

解题思路:分类讨论,有三种情况,第一种,不需要添加刻度,第二种,需要添加一个刻度就能间接得到x与y的长度,第三种,不能通过已知刻度以任何方式的加减得到x与y。

因为可能有多钟情况满足要求,所以只需要输出其中一种就行。

AC代码:

# include <stdio.h>
# include <string.h>
# include <stdlib.h>
# include <iostream>
# include <fstream>
# include <vector>
# include <queue>
# include <stack>
# include <map>
# include <set>
# include <math.h>
# include <algorithm>
using namespace std;
# define pi acos(-1.0)
# define mem(a,b) memset(a,b,sizeof(a))
# define FOR(i,a,n) for(int i=a; i<=n; ++i)
# define For(i,n,a) for(int i=n; i>=a; --i)
# define FO(i,a,n) for(int i=a; i<n; ++i)
# define Fo(i,n,a) for(int i=n; i>a ;--i)
typedef long long LL;
typedef unsigned long long ULL; int a[];
map<int,int>M; int main()
{
//freopen("in.txt", "r", stdin);
int q,l,x,y;
cin>>q>>l>>x>>y;
for(int i=;i<=q;i++)
{
cin>>a[i];
M[a[i]]=;
}
int flag1=,flag2=,flag=;
for(int i=;i<=q;i++)
{
if(M[a[i]+x]||M[x])flag1=;
if(M[a[i]+y]||M[y])flag2=;
if(M[a[i]+x+y])flag=a[i]+x;
if(M[a[i]+x-y])
{
if(a[i]+x<=l)flag=a[i]+x;
else if(a[i]-y>=)flag=a[i]-y;
}
}
if(flag1&&flag2)
{
cout<<<<endl;
}
else if(flag1)
{
cout<<<<endl;
cout<<y<<endl;
}
else if(flag2)
{
cout<<<<endl;
cout<<x<<endl;
}
else if(flag)
{
cout<<<<endl;
cout<<flag<<endl;
}
else
{
cout<<<<endl;
cout<<x<<' '<<y<<endl;
}
return ;
}

  

最新文章

  1. 【分享】图解Windows Server 2012 R2 配置IIS 8全过程
  2. jquery miniui , 普加甘特图,流程管理
  3. JavaScript模块化学习基础
  4. MATLAB信号与系统分析(四)&mdash;&mdash;离散信号与系统的复频域分析及MATLAB实现
  5. Chapter 6 Windows下编译pycaffe
  6. Win7开始菜单之【附件】不全解决方案
  7. Akka官方文档翻译:Cluster Specification
  8. Oracle- 包
  9. 不要在精确计算中使用float和double类型
  10. mysql sql语句大全(2)
  11. cron任务解释
  12. jquery checkbox是否选中
  13. C#序列化与反序列化。
  14. python - 语言介绍
  15. 【转】光盘和U盘安装win7和ubuntu14.04全步骤
  16. Git 从 master 分支拉新分支开发
  17. Datagrip连接SQLServer Connecting DataGrip to MS SQL Server
  18. 24小时学通Linux内核之构建Linux内核
  19. Mac 添加ll命令
  20. sklearn常见分类器的效果比较

热门文章

  1. .net core 学习小结之 Cookie-based认证
  2. [19/06/05-星期三] CSS基础_样式表的位置(内联、内部、外部样式)、块元素(div)、内联元素(span)、常用的选择器
  3. CentOS7 NAT配置
  4. 几个 BeanUtils 中的坑,千万别踩!
  5. 【五一qbxt】day3 动态规划
  6. C++中的新型类型转换
  7. [多校联考2019(Round 5 T3)]青青草原的表彰大会(dp+组合数学)
  8. jsoncpp解析
  9. (Windows)Python第三方库手动安装教程(以lxml库为例)
  10. Vue 中如何定义全局的变量和常量