#include<iostream> #include<map> #include<set> using namespace std; intmain() { int n; while(scanf("%d",&n) && n) { map<int, int> a, b; set<int> ans; bool flag = false; for (int i = 0; i < n; i++) { int x, y; cin >> x >> y; a[x] ++; b[y] ++; ans.insert(x); ans.insert(y); } set<int>::iterator it; for (it = ans.begin(); it !=ans.end(); it++) { if(a[*it] != b[*it]) { flag = true; break; } } if(flag) cout << "NO" << endl; else cout << "YES" << endl; } }
UVA - 10763 Foreign Exchange【map】
Guess you like
Origin http://43.154.161.224:23101/article/api/json?id=324882360&siteId=291194637
Recommended
Ranking