#include <iostream>
#include <vector>
#include <stack>
#include <list>
#include <map>
#include <set>
#include <deque>
#include <queue>
#include <cstring>
#include <unordered_map>
#include <unordered_set>
#include <algorithm>
#include <numeric>
#include <chrono>
#include <ctime>
#include <cmath>
#include <cctype>
#include <string>
#include <cstdio>
#include <iomanip>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <functional>
#include <iterator>
using namespace std;
map<pair<int, int>, int> mmp;
int main()
{
int n,a,b,total = 0;
pair<int, int> temp,temp2;
while (cin >> n && n) {
total = n;
mmp.clear();
for (int i = 0; i < n; ++i) {
cin >> a >> b;
temp.first = a; temp.second = b;
temp2.first = b; temp2.second = a;
if (!mmp.count(temp2)) {
mmp[temp]++;
}
else {
mmp[temp2]--;
if (mmp[temp2] == 0) mmp.erase(temp2);
total -= 2;
}
}
if (!total) cout << "YES" << endl;
else cout << "NO" << endl;
}
return 0;
}
习题5-4(uva-10763)
最新推荐文章于 2021-11-13 09:05:46 发布