hdu-6324-博弈
Problem F. Grab The Tree
Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 524288/524288 K (Java/Others)
Total Submission(s): 417    Accepted Submission(s): 286
In this game, Little Q needs to grab some vertices on the tree. He can select any number of vertices to grab, but he is not allowed to grab both vertices that are adjacent on the tree. That is, if there is an edge between x and y, he can't grab both x and y. After Q's move, Little T will grab all of the rest vertices. So when the game finishes, every vertex will be occupied by either Q or T.
The final score of each player is the bitwise XOR sum of his choosen vertices' value. The one who has the higher score will win the game. It is also possible for the game to end in a draw. Assume they all will play optimally, please write a program to predict the result.
In each test case, there is one integer n(1≤n≤100000) in the first line, denoting the number of vertices.
In the next line, there are n integers w1,w2,...,wn(1≤wi≤109), denoting the value of each vertex.
For the next n−1 lines, each line contains two integers u and v, denoting a bidirectional edge between vertex u and v.
3
2 2 2
1 2
1 3
hdu-6324-博弈的更多相关文章
- S-Nim HDU 1536 博弈 sg函数
		
S-Nim HDU 1536 博弈 sg函数 题意 首先输入K,表示一个集合的大小,之后输入集合,表示对于这对石子只能去这个集合中的元素的个数,之后输入 一个m表示接下来对于这个集合要进行m次询问,之 ...
 - HDU 5996 博弈
		
http://acm.hdu.edu.cn/showproblem.php?pid=5996 博弈论待补. 这题变化了一下,因为注意到奇数层的东西(层数从1开始),对手可以模仿地动,那就相当于没动. ...
 - HDU 4994  博弈。
		
F - 6 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status ...
 - A - 无聊的游戏 HDU - 1525(博弈)
		
A - 无聊的游戏 HDU - 1525 疫情当下,有两个很无聊的人,小A和小B,准备玩一个游戏,玩法是这样的,从两个自然数开始比赛.第一个玩家小A从两个数字中的较大者减去两个数字中较小者的任何正倍数 ...
 - hdu 1517 博弈 **
		
博弈题: 题意:2 个人玩游戏,从 1 开始,轮流对数进行累乘,直到超过一个指定的值. 解题思路:如果输入是 2 ~ 9 ,因为Stan 是先手,所以Stan 必胜如果输入是 10~18 ,因为Oll ...
 - Revenge of Nim hdu 4994 (博弈)
		
http://acm.split.hdu.edu.cn/showproblem.php?pid=4994 题意:现在有两个人在取石子,共有n堆石子,每堆石子取完后才可以取下一堆石子,最后一个取石子的人 ...
 - HDU 5795 博弈
		
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=5795 A Simple Nim Time Limit: 2000/1000 MS (Java/Oth ...
 - HDU 3863 (博弈) No Gambling
		
这是我见过的最简单的一道博弈了,其实不要被复杂的棋盘吓到了. 首先肯定会有而且仅有一个人胜,而且因为棋盘是对称的,所以先手相对于后手肯定更有优势,那么肯定是先手赢. 这是不是严格的推理,但是确实比较容 ...
 - HDU 3537 (博弈 翻硬币) Daizhenyang's Coin
		
可以参考Thomas S. Ferguson的<Game Theory>,网上的博客大多也是根据这个翻译过来的,第五章讲了很多关于翻硬币的博弈. 这种博弈属于Mock Turtles,它的 ...
 - HDU 2147 (博弈) kiki's game
		
无奈英语不好又被坑,看到棋子能左移下移左下移,想当然地以为是Wythoff博弈了,=u= 题的意思是说每次只能选一个方向移动一步,所以找找规律就是横纵坐标为奇数的时候是必败状态. 从http://ww ...
 
随机推荐
- 安装Hue后的一些功能的问题解决干货总结(博主推荐)
			
不多说,直接上干货! 我的集群机器情况是 bigdatamaster(192.168.80.10).bigdataslave1(192.168.80.11)和bigdataslave2(192.168 ...
 - 学写网页 #05# CSS Mastery 笔记 1~3
			
看到第四章才发现这本书已经太旧了..看到第 3 章为止吧.前三章主要讲的内容:一些编码常识.怎样选择元素.盒子模型(主要是 Margin).定位(绝对.相对.浮动.fixed 等) 第一章 conve ...
 - Python中模块(Module)和包(Package)的区别
			
本文绝大部分内容转载至:廖雪峰官方网站 1. 模块(Module) 在计算机程序的开发过程中,随着程序代码越写越多,在一个文件里代码就会越来越长,越来越不容易维护. 为了编写可维护的代码,我们把很多函 ...
 - PHP实现多进程并行操作,可做守护进程(转,备用)
			
<?php /** * 入口函数 * 将此文件保存为 ProcessOpera.php * 在terminal中运行 /usr/local/php/bin/php ProcessOpera.ph ...
 - c++中的字符集与中文
			
就非西欧字符而言,比如中国以及港澳台,在任何编程语言的开发中都不得不考虑字符集及其表示.在c++中,对于超过1个字节的字符,有两种方式可以表示: 1.多字节表示法:通常用于存储(空间效率考虑). 2. ...
 - Python数据分析入门之pandas基础总结
			
Pandas--"大熊猫"基础 Series Series: pandas的长枪(数据表中的一列或一行,观测向量,一维数组...) Series1 = pd.Series(np.r ...
 - hdu 6180 Schedule
			
Schedule Problem Description There are N schedules, the i-th schedule has start time si and end time ...
 - linux 下 安装nginx
			
http://www.cnblogs.com/lovexinyi8/p/5845017.html 测试可用. 参看 https://www.cnblogs.com/liujuncm5/p/671378 ...
 - java中new一个对象和对象=null有什么区别
			
原创:转载请注明出处 今天在写代码时,遇到一个问题,特此进行记录. for (ProfileDto profileDto : profile) { // Profile resP ...
 - UVa 11584 划分成回文串
			
https://vjudge.net/problem/UVA-11584 题意: 给出一串字符,把它划分成尽量少的回文串. 思路: 用d[i]表示划分到i时所能划分的最小个数,转移方程为d[i]=mi ...