A Chess Game
来源:互联网 发布:linux奶瓶破解wifi 编辑:程序博客网 时间:2024/04/30 05:35
http://poj.org/problem?id=2425
// File Name: poj2425.cpp// Author: bo_jwolf// Created Time: 2013年10月06日 星期日 16:06:50#include<vector>#include<list>#include<map>#include<set>#include<deque>#include<stack>#include<bitset>#include<algorithm>#include<functional>#include<numeric>#include<utility>#include<sstream>#include<iostream>#include<iomanip>#include<cstdio>#include<cmath>#include<cstdlib>#include<cstring>#include<ctime>using namespace std;const int maxn = 1005;int n, m, temp, sg[ maxn ];vector<vector<int> >Q;int getSg( int n ){if( sg[ n ] != -1 )return sg[ n ];int vis[ maxn ] = { 0 };for( int i = 0; i < Q[ n ].size(); ++i ){if( sg[ Q[ n ][ i ] ] == -1 ){sg[ Q[ n ][ i ] ] = getSg( Q[ n ][ i ] );}vis[ sg[ Q[ n ][ i ] ] ] = 1;}for( int i = 0; ; ++i ){if( !vis[ i ] )return i;}return 0;}int main(){while( scanf( "%d", &n ) != EOF ){Q.clear();Q.resize( n + 1 );memset( sg, -1, sizeof( sg ) );for( int i = 0; i < n; ++i ){scanf( "%d", &m );while( m-- ){scanf( "%d", &temp );Q[ i ].push_back( temp );}}while( scanf( "%d", &m ) != EOF && m ){int ans = 0;while( m-- ){scanf( "%d", &temp );ans ^= getSg( temp );}if( ans )printf( "WIN\n" );elseprintf( "LOSE\n" );}}return 0;}
- hdu1524 A Chess Game
- A Chess Game
- POJ A Chess Game
- hdu 1524 A Chess Game
- A Chess Game(poj 2425)
- POJ2425 A Chess Game(博弈)
- [poj 2425]A Chess Game
- POJ 2425 A Chess Game
- poj 2425 A Chess Game
- hdu 1524 A Chess Game
- pku 2425 A Chess Game(SG函数)
- poj 2425 A Chess Game (sg函数)
- HDOJ 1524 A Chess Game SG函数
- HDU 1524 - A Chess Game(SG)
- 【PKU】A Chess Game(sg函数)
- HDU 1524 A Chess Game 【SG函数】
- hdu 1524 A Chess Game (SG)
- hdu 1524 A Chess Game 博弈论
- T_SQL备份数据库
- Android中shape的使用
- float除0
- 【Java工程师之路】[1-2.6]Java面向对象详解5
- hdu3555
- A Chess Game
- 九度OnlineJudge之1036:Old Bill
- PB安装包,PB安装程序,PB开发工具,powerbuilder安装包,powerbuilder安装程序,powerbuilder开发工具下载地址
- 二叉树
- MyEclipse maven的内置Tomcat
- ios开发-UIColor的使用。
- 怎么将GPT转换为MBR格式分区
- 图像特征提取与匹配之SIFT算法
- 拷贝构造函数