标签:void using mes 自己 技术分享 映射 ack width bsp
//附上自己被碾压的代码
#include <cstdio>
#include <set>
#include <map>
#include <vector>
using namespace std;
map <pair<int, int>, int> Map;//从pair映射到每一个pair的数量
vector <pair<int, int>> Pa;//存储不重复pair
int main(void)
{
int n;
while (~scanf("%d", &n)&&n)
{
Map.clear(), Pa.clear();
bool flag = 0;
int kases = 0;
for (int i = 0;i < n;i++)
{
int a, b;
pair<int, int>p1;
scanf(" %d %d", &a, &b);
p1.first = a, p1.second = b;
if(!Map.count(p1))
{
Pa.push_back(p1);
Map[p1] = 1;
kases++;
}
else Map[p1]++;
}
if(n%2==1) { printf("NO\n");continue; }
for (int i = 0;i < kases;i++)
{
pair<int, int>p1,p2 = Pa[i];
p1.first = p2.second, p1.second = p2.first;
if (Map[p1]!=Map[p2]) { flag = 1;break; }//正反pair必须数量相等
}
if (flag == 1) { printf("NO\n");continue; }
else printf("YES\n");
}
return 0;
}
标签:void using mes 自己 技术分享 映射 ack width bsp
原文地址:http://www.cnblogs.com/schsb/p/7804470.html