比赛 Asm.Def战记之圣地亚哥“杯2015 评测结果 AWAWWWWWWA
题目名称 Asm.Def的游戏 最终得分 30
用户昵称 StanTia 运行时间 0.247 s
代码语言 C++ 内存使用 0.31 MiB
提交时间 2015-10-31 09:32:24
显示代码纯文本
#include <iostream>
#include <vector>
#include <stdio.h>
using namespace std;

vector<int>* point;
int* degree;
int num;
vector<int> for_xor;

void init()
{
	freopen("asm_game.in","r",stdin);
	freopen("asm_game.out","w",stdout);
	cin>>num;
	int edge_num;
	cin>>edge_num;
	point = new vector<int>[num + 1];
	degree = new int[num+1];
	int from;
	int to;
	for(int i = 0; i<num + 1; i++)
	{
		degree[i] = 0;
	}
	for(int i = 0; i<edge_num; i++)
	{
		cin>>from>>to;
		//point[from].push_back(to);
		//point[to].push_back(from);
		degree[from]++;
		degree[to]++;
	}
	/*for(int i = 1; i<=num; i++)
	{
		printf("degree[%d] = %d\n",i,degree[i]);
	}
	printf("000\n");*/
}

int main()
{
	init();
	for(int i = 0; i<= num;i++)
	{
		int size = point[i].size();
		if(degree[i] >= 3)
		{
			for_xor.push_back(i);
			continue;
		}
	
		
	}
	/*
	for(vector<int>::iterator iter = for_xor.begin(); iter!= for_xor.end();iter++)
	{
		cout<<*iter<<endl;
	}
	cout<<"000"<<endl;
	
	*/
	int output = 0;
	int i = 1;
	for(vector<int>::iterator iter = for_xor.begin(); iter!= for_xor.end();iter++)
	{
		if((*iter) == for_xor[0])
		{
			output = *iter;
			//cout<<i<<" "<<output<<endl;
			i++;
			continue;
		}
		output = output xor (*iter);
		//cout<<i<<" "<<output<<endl;
		i++;
	}
	cout<<output;
	return 0;
}