cf787c 博弈论+记忆化搜索】的更多相关文章

好题,单纯的就是pn状态的推导 /* 把第一个点标为0,剩下的点按1-n-1编号 胜态是1,败态为0,dp[i][j]表示第i个人,怪兽起始位置在j时的胜负态 把0点设置为必败态,然后对于一个人来说,所有能到0点的点都设为必胜态,然后对于另一个人来说,如果他所有选择都会走到对手的必胜态上,那么这个状态就是必败 */ #include<bits/stdc++.h> using namespace std; #define maxn 10000 vector<]; ][maxn],chose…
思路:状态最多有2^12,采用记忆化搜索!! 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<iomanip> #include<cmath> #include<cstring> #include<vector> #define inf 1<<30 using namespace std; ]={{,},{,},{,…
思路:总共有18条边,9个三角形. 极大极小化搜索+剪枝比较慢,所以用记忆化搜索!! 用state存放当前的加边后的状态,并判断是否构成三角形,找出最优解. 代码如下: #include<iostream> #include<stdio.h> #include<algorithm> #include<iomanip> #include<cmath> #include<cstring> #include<vector> #d…
3895: 取石子 Time Limit: 1 Sec  Memory Limit: 512 MBSubmit: 361  Solved: 177[Submit][Status][Discuss] Description Alice和Bob两个好朋含友又开始玩取石子了.游戏开始时,有N堆石子 排成一排,然后他们轮流操作(Alice先手),每次操作时从下面的规则中任选一个: ·从某堆石子中取走一个 ·合并任意两堆石子 不能操作的人输.Alice想知道,她是否能有必胜策略.   Input 第一行输…
D. MADMAX time limit per test1 second memory limit per test256 megabytes Problem Description As we all know, Max is the best video game player among her friends. Her friends were so jealous of hers, that they created an actual game just to prove that…
In a world where ordinary people cannot reach, a boy named "Koutarou" and a girl named "Sena" are playing a video game. The game system of this video game is quite unique: in the process of playing this game, you need to constantly fac…
Alice and Bob Time Limit: 20 Sec  Memory Limit: 256 MB 题目连接 http://acm.hdu.edu.cn/showproblem.php?pid=4111 Description Alice and Bob are very smart guys and they like to play all kinds of games in their spare time. The most amazing thing is that they…
题意 在一个有向无环图上,两个人分别从一个点出发,两人轮流从当前点沿着某条边移动,要求经过的边权不小于上一轮对方经过的边权(ASCII码),如果一方不能移动,则判负.两人都采取最优策略,求两人分别从每个点出发的胜负关系表. 分析 记忆化搜索. f[x][y][v]表示现在两人分别在x,y,上一轮经过的边权为v时x是否能胜利(胜利为1,失败为0). 考虑如何转移: 对于一条从x到u的边权为val的边,如果val>=v,则可以走这条边,算出f[y][u][val], 如果f[y][u][val]为0…
1.直接用递归函数计算状态转移方程,效率十分低下,可以考虑用递推方法,其实就是“正着推导,逆着计算” #include<iostream> #include<algorithm> using namespace std; #define maxn 1000+5 int n; int a[maxn][maxn]; int d[maxn][maxn]; int main(){ for(;cin>>n && n;){ memset(d,,sizeof(d));…
3895: 取石子 Time Limit: 1 Sec  Memory Limit: 512 MBSubmit: 263  Solved: 127[Submit][Status][Discuss] Description Alice和Bob两个好朋含友又开始玩取石子了.游戏开始时,有N堆石子 排成一排,然后他们轮流操作(Alice先手),每次操作时从下面的规则中任选一个: ·从某堆石子中取走一个 ·合并任意两堆石子 不能操作的人输.Alice想知道,她是否能有必胜策略. Input 第一行输入T…