题目链接
代码:
#include <iostream>
#include <algorithm>
#include <map>
using namespace std;
typedef pair<int,int> p;
int main()
{
int n;
while(cin>>n && n)
{
int a,b,cnt=n;
map<p,int> m;
for(int i=0;i<n;i++)
{
cin>>a>>b;
if(!m[{b,a}]) m[{a,b}]++;
else m[{b,a}]--,cnt-=2;
}
if(!cnt) cout<<"YES"<<endl;
else cout<<"NO"<<endl;
}
return 0;
}
本文地址:https://blog.csdn.net/weixin_45260385/article/details/108184282