比赛 |
Asm.Def战记之圣地亚哥“杯2015 |
评测结果 |
AAAAAAAAAA |
题目名称 |
Asm.Def的游戏 |
最终得分 |
100 |
用户昵称 |
Binary10 |
运行时间 |
0.359 s |
代码语言 |
C++ |
内存使用 |
1.74 MiB |
提交时间 |
2015-10-31 11:22:16 |
显示代码纯文本
#include<set>
#include<map>
#include<stack>
#include<queue>
#include<cmath>
#include<cctype>
#include<cstdio>
#include<string>
#include<vector>
#include<cstring>
#include<cstdlib>
#include<utility>
#include<iostream>
#include<algorithm>
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
const int INF = 0x3f3f3f3f;
const int maxn = 100010, maxm = 500010;
int n, m, deg[maxn];
vector<int> G[maxn];
bool deled[maxn], ok = false;
void del(int u){
ok = false;
deg[u]--; deled[u] = true;
for(int i = 0; i < G[u].size(); i++){
int v = G[u][i];
if(!deled[v] && --deg[v] < 3) del(v);
}
}
int main()
{
freopen("asm_game.in", "r", stdin);
freopen("asm_game.out", "w", stdout);
cin >> n >> m;
int u, v;
memset(deg, 0, sizeof(deg));
for(int i = 0; i < m; i++){
scanf("%d%d", &u, &v);
G[u].push_back(v); deg[u]++;
G[v].push_back(u); deg[v]++;
}
memset(deled, false, sizeof(deled));
while(!ok){
ok = true;
for(int i = 1; i <= n; i++)
if(!deled[i] && deg[i] < 3) del(i);
}
bool first = true;
int ans = 0;
for(int i = 1; i <= n; i++)
if(!deled[i]){
if(first){
ans = i;
first = false;
}
else ans = ans ^ i;
}
cout << ans << endl;
return 0;
}