比赛 |
20160414 |
评测结果 |
AAAAWAWAAAWAWAAAAAAA |
题目名称 |
树木园 |
最终得分 |
80 |
用户昵称 |
mikumikumi |
运行时间 |
0.879 s |
代码语言 |
C++ |
内存使用 |
1.02 MiB |
提交时间 |
2016-04-14 17:29:33 |
显示代码纯文本
- #include<cstdio>
- #include<iostream>
- #include<algorithm>
- using namespace std;
- const int SIZEN=100010;
- int N,M;
- int d[2][SIZEN];
- void read()
- {
- scanf("%d%d",&N,&M);
- int x,y;
- for(int i=1;i<=M;i++)
- {
- scanf("%d%d",&x,&y); d[0][x]++;d[0][y]++;
- }
- for(int i=1;i<=M;i++)
- {
- scanf("%d%d",&x,&y);d[1][x]++;d[1][y]++;
- }
- }
- void work()
- {
- sort(d[0]+1,d[0]+1+N);
- sort(d[1]+1,d[1]+1+N);
- for(int i=1;i<=N;i++)
- {
- if(d[0][i]!=d[1][i])
- {
- printf("NO\n");
- return;
- }
- }
- printf("YES\n");
- }
- int main()
- {
- freopen("cactus.in","r",stdin);
- freopen("cactus.out","w",stdout);
- read();
- work();
- return 0;
- }