include
include
include
include
include
include
include
include
include
include
using namespace std;
set > relations;
vector girls;
vector boy;
int main()
{
int n,m,k;
scanf(“%d %d %d”,&n,&m,&k);
for(int i=0; i<n; i++)
{
int mid;
scanf("%d",&mid);
girls.push_back(mid);
}
for(int i=0; i<m; i++)
{
int mid;
scanf("%d",&mid);
boy.push_back(mid);
}
//确立映射关系
for(int i=0; i<k; i++)
{
int small,big;
scanf("%d %d",&small,&big);
if(small==big)
continue;
relations.insert(make_pair(max(small,big),min(small,big)));
}
if(n!=m) //特判,代码数量不相同,那么肯定就不是完全抄袭的
{
cout<<"No"<<endl;
return 0;
}
for(int i=0; i<n&&i<m; i++)
{
if(girls[i]==boy[i])
continue;
if(relations.find(make_pair(max(girls[i],boy[i]),min(girls[i],boy[i])))==relations.end())
{
cout<<"No"<<endl;
return 0;
}
}
cout<<"Yes"<<endl;
return 0;
}
值得注意的是,如果把set改成unordered_set,那么就会编译报错。所以只能用set