比赛 |
Asm.Def战记之圣地亚哥“杯2015 |
评测结果 |
AWWWWWWWWW |
题目名称 |
Asm.Def的游戏 |
最终得分 |
10 |
用户昵称 |
pppoooiiizzy |
运行时间 |
0.096 s |
代码语言 |
C++ |
内存使用 |
1.84 MiB |
提交时间 |
2015-10-31 09:03:04 |
显示代码纯文本
#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
#include<vector>
#include<queue>
#include<set>
#include<string>
const int maxn = 100000 + 5;
using namespace std;
#define rep(i, j, k) for(int i = j; i <= k; i++)
#define drep(i, j, k) for(int i = j; i >= k; i--)
#define INF 0x3fffffff
inline int read()
{
int x = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') {if( ch == '-') f = -1; ch = getchar();}
while(ch >= '0' && ch <= '9') {x = x * 10 + ch - '0'; ch = getchar();}
return x * f;
}
vector<int>G[maxn];
int m, n, Ar, Sa, s, t, La;
int ans[maxn];
void add(int from, int to)
{
G[from].push_back(to);
G[to].push_back(from);
}
bool endd()
{
rep(i, 1, n)
if( G[i].size() < 3) {
return true;
}
return false;
}
int main()
{
freopen("asm_game.in", "r", stdin);
freopen("asm_game.out", "w", stdout);
n = read(); m = read();
if(n <= 3) {
printf("%d\n", 0);
return 0;
}
rep(i, 1, m) {
Ar = read(); Sa = read();
add(Ar, Sa);
}
int temp = 0;
//rep(i, 1, n) cout<<G[i].size()<<endl;
while( !endd() ) {
rep(i, 0, n - 1)
if( G[i].size() < 3) {
rep(j, 0, G[i].size() - 1) {
int e = G[i][j];
G[e].erase(remove(G[e].begin(), G[e].end(), e), G[e].end());
}
G[i].clear();
}
}
int cnt = 0;
rep(i, 0, n - 1) {
if( G[i].size() ) ans[++cnt] = i;
}
//rep(i, 0, cnt - 1) printf("%d\n", ans[i]);
rep(i, 0, cnt - 1) La ^= ans[i];
printf("%d\n" ,La);
return 0;
}