算法竞赛入门经典(第二版)-刘汝佳-第五章 交流生
来源:互联网 发布:油画笔 知乎 编辑:程序博客网 时间:2024/05/17 01:18
#include<cstdio>#include<cstring>#include<cstdlib>#include<string>#include<sstream>#include<iostream>#include<algorithm>#include<set>#include<map>#include<vector>using namespace std;struct node{int a,b;node(int x,int y){a=x,b=y;}bool operator < (const node &n) const{if(n.a!=a) return n.a<a;return n.b<b;}};int main(){//freopen("1.txt","r",stdin);//freopen("out.txt","w",stdout);int n;while(scanf("%d",&n),n){map<node,int> m;int i,j;for(i=0;i<n;i++){int a,b;scanf("%d%d",&a,&b);node x(a,b);m[x]++;j++;}map<node,int>::iterator it;for(it=m.begin();it!=m.end();it++){node x=it->first;swap(x.a,x.b);if( it->second!=m[x] ) break;}if(it==m.end()) printf("YES\n");else printf("NO\n");}return 0;}
1.结构体所有元素都要排序。
0 0
- 算法竞赛入门经典(第二版)-刘汝佳-第五章 交流生
- 算法竞赛入门经典(第二版)-刘汝佳-第五章 C++与STL 例题(9/12)
- 算法竞赛入门经典(第二版)-刘汝佳-第五章 C++与STL 习题(13/16)
- 算法竞赛入门经典第二版 第二章
- 算法竞赛入门经典 第五章 字符串
- 算法竞赛入门经典 第五章 6174
- 算法竞赛入门经典-第五章源代码
- 算法竞赛入门经典第五章
- 算法竞赛入门经典第五章习题
- 算法竞赛入门经典第五章习题
- 算法竞赛入门经典 第二章
- 算法竞赛入门经典第二章练习
- 算法竞赛入门经典第二章笔记
- 算法竞赛入门经典-第二章源代码
- 算法竞赛入门经典第二章
- 算法竞赛入门经典(第二章)
- 算法竞赛入门经典第二章习题
- 算法竞赛入门经典习题 第二章
- 注解实现增删改查
- 获得KeyStore的sha1值
- HDU 2044 一只小蜜蜂...
- 用C语言开发FastCGI应用程序——fcgi_stdio包API
- HTTP状态码大全
- 算法竞赛入门经典(第二版)-刘汝佳-第五章 交流生
- nstring
- FusionCharts简单教程(一)---建立第一个FusionCharts图形
- java email发送邮件测试
- Objective-C文字换行方式(解决英文在行末时的换行问题)
- 1对多(1个班级有多个学生)
- FlycoTabLayout的用法
- #leetcode#Nim Game
- Oracle 左连接、右连接、全外连接、(+)号作用