UVA10763解题报告

来源:互联网 发布:斯利曼尼俱乐部数据 编辑:程序博客网 时间:2024/06/01 09:09

水题留念

Time 0.22s

#include<cstdio>#include<map>#include<sstream>using namespace std;typedef pair<int,int> P;int main(){    int n;    while(scanf("%d",&n)==1 && n)    {        map<P,int> m;        int x,y;        for(int i=0;i<n;i++)        {            scanf("%d %d",&x,&y);            P p=make_pair(y,x);            if(m.count(p)) { m[p]--; if(m[p]==0) m.erase(p); }            else { p=make_pair(x,y); if(!m.count(p)) m[p]=1; else m[p]++; }        }        if(!m.size()) printf("YES\n");        else printf("NO\n");    }    return 0;}


原创粉丝点击