码迷,mamicode.com
首页 >  
搜索关键字:zoj 3690 choosing n    ( 3596个结果
ZOJ 3798 Abs Problem
找规律.... Abs Problem Time Limit: 2 Seconds      Memory Limit: 65536 KB      Special Judge Alice and Bob is playing a game, and this time the game is all about the absolute value! Alice ...
分类:其他好文   时间:2014-09-11 22:28:12    阅读次数:233
zoj 3812 We Need Medicine (dp 位优化 巧妙记录路径)
We Need Medicine Time Limit: 10 Seconds      Memory Limit: 65536 KB      Special Judge A terrible disease broke out! The disease was caused by a new type of virus, which will lead to lethal l...
分类:其他好文   时间:2014-09-11 21:02:22    阅读次数:204
ZOJ 3805 Machine
搜索.... Machine Time Limit: 2 Seconds      Memory Limit: 65536 KB In a typical assembly line, machines are connected one by one. The first machine's output product will be the second mac...
分类:其他好文   时间:2014-09-11 20:59:42    阅读次数:186
【ZOJ】3812 We Need Medicine
这道题就题意来说其实就是一道简单的记录路径的0,1背包,告诉你n个物品,每种物品只能取一次,再有q个询问,问你是否能在满足选出物品的w之和为m的情况下,满足t之和为s的情况,若可以则任意输出一种方案。 因此我们可以设计状态,dp[i][j][k]为前i个物品选出部分,当t之和为j时,w之和为k的情况能否满足,若存在方案则为1,不存在则为0。而状态的转移方程也是很简单。 dp[i][j+t[i]...
分类:其他好文   时间:2014-09-11 19:23:52    阅读次数:173
Untrusted Patrol 14牡丹江网络赛C
题意:给定一个n个点,m条边的图,其中k个点上有探测器 再给定一个探测器第一次被遍历的序列,问是否存在一种遍历顺序使得满足给定序列且遍历完所有点 思路:从第一个被遍历的探测器开始dfs,每次访问到探测器遍停止,访问到非探测器节点便搜下去。结束后判断给定序列下个探测 器是否被访问过,若没有,说明无法不通过 其他 探测器到达此探测器,无解。若被访问过,继续dfs此结点。 这样d...
分类:其他好文   时间:2014-09-11 12:33:31    阅读次数:168
ZOJ 3817 Chinese Knot(牡丹江网络赛I题)
ZOJ 3817 Chinese Knot 题目链接 思路:万万没想到这题直接hash+暴力剪枝就可以了,把4个串正逆都hash出来,然后每次枚举起点去dfs记录下路径即可,剪枝为如果一旦有一点不匹配就不往后搜(这个很容易想到0 0) 代码: #include #include #include #include using namespace std; type...
分类:其他好文   时间:2014-09-11 11:16:41    阅读次数:196
2014牡丹江网络预选赛F题(隐式图BFS暴搜)zoj3814
Sawtooth Puzzle Time Limit: 10 Seconds      Memory Limit: 65536 KB Recently, you found an interesting game called Sawtooth Puzzle. This is a single-player game played on a grid with 3 x 3 cells....
分类:其他好文   时间:2014-09-11 09:42:44    阅读次数:248
ZOJ 3812 We Need Medicine 01背包+位优化
题目链接:点击打开链接 #include #include #include #include #include typedef unsigned long long ll; using namespace std; const int N = 400 + 1; const int M = 200000 + 1; int t[N], w[N], g[51][M], ans[N], de...
分类:其他好文   时间:2014-09-10 23:57:41    阅读次数:502
ZOJ 3812 We Need Medicine(牡丹江网络赛D题)
ZOJ 3812 We Need Medicine 题目链接 思路:dp[i][j][k]表示第i个物品,组成两个值为j和k的状态,这样会爆掉,所以状态需要转化一下 首先利用滚动数组,可以省去i这维,然后由于j最大记录到50,所以可以把状态表示成一个二进制数s,转化成dp[k] = s,表示组成k状态能组成s,这样空间复杂度就可以接受了,然后这题时限还可以,就这样去转移,然后记录...
分类:其他好文   时间:2014-09-10 22:33:31    阅读次数:261
zoj 3818 2014牡丹江网赛
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5350 昨天写死都是WA,今天按枚举a,b,c的长度以及调用string类的函数substr,1A..... 还是调用系统函数代码能短很多而且代码短意味着出错机会少&思考的逻辑更容易...... 写贴个昨天的WA代码  还是不明白为啥WA..... //#pragma c...
分类:其他好文   时间:2014-09-10 22:33:01    阅读次数:324
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!