问题
https://vjudge.net/problem/UVA-10763
分析
#include <iostream>
#include <cstdio>
#include <cmath>
#include <cstring>
#include <map>
#include <string>
#include <vector>
#include <algorithm>
#include <queue>
using namespace std;
typedef long long LL;
const int maxn=100000+5;
int n,a,b;
map<int,int> m;
int main(void){
while(scanf("%d",&n)==1 && n){
m.clear();
for(int i=0;i<n;++i){
scanf("%d%d",&a,&b);
m[a]--;
m[b]++;
}
int flag=1;
for(auto it=m.begin();it!=m.end();++it){
if(it->second!=0){
flag=0;
break;
}
}
printf("%s\n",flag?"YES":"NO");
}
return 0;
}