码迷,mamicode.com
首页 >  
搜索关键字:DFS Troubleshooting    ( 10753个结果
11181-Probability
不得不说这道题十分猥琐啊,递归求解,我RE了接近20次,最后发现还是数组开小了。 #include #include #include #include #include using namespace std; int biao[250000],n,r,zhi = 0; double p[250000],possi[250000]; int v[250000][25]; void dfs(in...
分类:其他好文   时间:2014-08-15 18:00:59    阅读次数:227
HDU 2614 Beat (dfs)
HDU 2614 Beat (dfs) 题的难度与做题顺序有关...
分类:其他好文   时间:2014-08-15 17:59:29    阅读次数:177
SGU 172.eXam
时间限制:0.25s空间限制:4M题意: 将n(n#include #include using namespace std;int n,m,x,y,tol;bool g[209][209];int f[30009];int dfs(int x){ for(int i=1;i<=n;...
分类:其他好文   时间:2014-08-15 17:34:19    阅读次数:177
二分图基础--Girls and Boys
二分图模板,剩下的就是建图的过程。 int dfs(int a) { int i; for(i=0;i<n;i++) { if(!vis[i]&&mapp[a][i]) { vis[i] = 1; if(dis[i]==-1||dfs(dis[i])) { ...
分类:其他好文   时间:2014-08-15 16:08:19    阅读次数:194
HDU1179_Ollivanders: Makers of Fine Wands since 382 BC.(二分图/最大匹配)
解题报告 题意: n个巫师m个魔杖,每个魔杖可以被不同的巫师使用。求多少个魔杖会被买。 思路: 二分图最大匹配简单题。 #include #include #include using namespace std; int mmap[110][110],n,m,vis[110],pre[110]; int dfs(int x) { for(int i=1; i<=n; i...
分类:其他好文   时间:2014-08-15 16:02:39    阅读次数:258
zoj 1008 Gnome Tetravex (dfs+枚举)
Gnome Tetravex Time Limit: 10 Seconds      Memory Limit: 32768 KB Hart is engaged in playing an interesting game, Gnome Tetravex, these days. In the game, at the beginning, the player is given...
分类:其他好文   时间:2014-08-15 16:00:49    阅读次数:270
HDU1253
一个简单的三维BFS: 刚开始说内存超出了,就把 标记走过的路语句 和 判断到达终点的语句 放在了push(next)之前 #include #include #include #include #define N 51 using namespace std; struct node{ int x,y,z; int t; }; int dir[8]...
分类:其他好文   时间:2014-08-15 14:45:28    阅读次数:292
CodeForces 29D Ant on the Tree
给一颗树,1为根,要求遍历树上所有点,给出叶子结点的访问顺序,限制每条边至多访问两次。 首先这是一棵树,那么两点之间的路线是确定的,所以我第一遍dfs预处理出从根节点到每个叶子的路径保存,以便后面输出。 那么就按照题目要求输出叶子结点的顺序依次输出,然后从一个叶子到下一个叶子的时候,从他们的最近公共祖先转折,所以我还预处理了相邻两个叶子结点的LCA。 #include...
分类:其他好文   时间:2014-08-15 14:37:08    阅读次数:220
PKU 1562/HDU 1241 Oil Deposits(原油有多少块区域---BFS,DFS)
Oil Deposits Time Limit:1000MS     Memory Limit:32768KB     64bit IO Format:%I64d & %I64u Description The GeoSurvComp geologic survey company is responsible for detecting underground oil ...
分类:其他好文   时间:2014-08-15 12:59:08    阅读次数:208
UVA-6436 The Busiest City 树形DFS求解
给出n个顶点,n-1条边,对于每一个顶点来说每有一条路径经过,繁荣度+1,求最大繁荣度。 经过的含义就是这条路径使用了跟这个顶点相连的边中的的两条,任意组合都可以,所以要找出每个顶点相连的边延伸出去有多少种情况。 从第一个顶点开始建树,对于第i个节点有sum[i]个子节点,因此dp[i]=sum[i]*(n-1-sum[i]),再加上节点的n棵子树的节点数乘积/2。 #include #i...
分类:其他好文   时间:2014-08-15 10:43:48    阅读次数:233
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!