就是暴力的四种方法都算出答案,然后进行比较有没有这个答案就好了
#include<bits/stdc++.h>
#define sf scanf
#define scf(x) scanf("%d",&x)
#define scff(x,y) scanf("%d%d",&x,&y)
#define scfff(x,y,z) scanf("%d%d%d",&x,&y,&z)
#define pf printf
#define prf(x) printf("%d
",x)
#define mm(x,b) memset((x),(b),sizeof(x))
#define rep(i,a,n) for (int i=a;i<n;i++)
#define per(i,a,n) for (int i=a;i>=n;i--)
#define pb push_back
typedef long long ll;void read(int &x){
int f=1;x=0;char s=getchar();
while(s<'0'||s>'9'){if(s=='-')f=-1;s=getchar();}
while(s>='0'&&s<='9'){x=x*10+s-'0';s=getchar();}
x*=f;}
const ll mod=1e9+100;
const double eps=1e-8;
using namespace std;
const double pi=acos(-1.0);
const int inf=0xfffffff;
const int N=1005;
vector<int> v[3];
vector<int> vv[3];
vector<int> ans[4];
int main()
{
int x,n,m,k;
scfff(n,m,k);
rep(i,0,n)
{
scf(x);
v[0].pb(x);
}
rep(i,0,m)
{
scf(x);
v[1].pb(x);
}
rep(i,0,k)
{
scf(x);
v[2].pb(x);
}
sort(v[0].begin(),v[0].end());
sort(v[1].begin(),v[1].end());
sort(v[2].begin(),v[2].end());
vv[0].pb(v[0][0]);
vv[1].pb(v[1][0]);
vv[2].pb(v[2][0]);
rep(j,0,3)
rep(i,1,v[j].size())
{
if(v[j][i]!=v[j][i-1])
vv[j].pb(v[j][i]);
}
n=vv[0].size();
m=vv[1].size();
k=vv[2].size();
int pos1=0,pos2=0;
while(1)//进行并集和交集的
{
if(pos1==n&&pos2==m)break;
if(pos1==n)
ans[0].pb(vv[1][pos2++]);
else if(pos2==m)
ans[0].pb(vv[0][pos1++]);
else
{
if(vv[0][pos1]>vv[1][pos2])
{
ans[0].pb(vv[1][pos2++]);
}else if(vv[0][pos1]<vv[1][pos2])
{
ans[0].pb(vv[0][pos1++]);
}else
{
ans[0].pb(vv[0][pos1]);
ans[1].pb(vv[0][pos1]);
pos1++;
pos2++;
}
}
}
pos1=0;pos2=0;
while(1)//进行1减2
{
if(pos1==n)
break;
else if(pos2==m)
ans[2].pb(vv[0][pos1++]);
else
{
if(vv[0][pos1]>vv[1][pos2])
{
pos2++;
}else if(vv[0][pos1]<vv[1][pos2])
{
ans[2].pb(vv[0][pos1++]);
}else
{
pos1++;
pos2++;
}
}
}
pos1=0;pos2=0;
while(1)//进行2减1
{
if(pos2==m)
break;
else if(pos1==n)
ans[3].pb(vv[1][pos2++]);
else
{
if(vv[0][pos1]>vv[1][pos2])
{
ans[3].pb(vv[1][pos2++]);
}else if(vv[0][pos1]<vv[1][pos2])
{
pos1++;
}else
{
pos1++;
pos2++;
}
}
}
rep(i,0,4)//比较四种答案
{
if(ans[i].size()==vv[2].size())
{
int temp=1;
rep(j,0,ans[i].size())
{
if(ans[i][j]!=vv[2][j])
{
temp=0;
break;
}
}
if(temp)
{
rep(j,0,vv[2].size())
{
if(j==0)
pf("%d",vv[2][j]);
else
pf(" %d",vv[2][j]);
}
return 0;
}
}
}
pf("What a pity!");
return 0;
}