码迷,mamicode.com
首页 >  
搜索关键字:剪枝    ( 1397个结果
Hopscotch.(POJ-3050)
穷竭搜索。。无法剪枝。 #include #include #include #include #include using namespace std; int a[10][10]; char A[15]; int dx[] = {0,1,0,-1}; int dy[] = {1,0,-1,0}; set G; void dfs(int i,int j,int cur) { if(cu...
分类:其他好文   时间:2015-04-16 17:40:08    阅读次数:153
ZOJ 3865 Superbot BFS 搜索
不知道为什么比赛的时候一直想着用DFS 来写一直想剪枝结果还是TLE = =这题数据量不大,又是问最优解,那么一般来说是用 BFS 来写int commandi[4] = {1, 2, 3, 4};我定义了一个方向数组,其实题目意思中的,指针移动还有操作版的变化本质上都是指针的移动在此只需要 额外定...
分类:其他好文   时间:2015-04-13 18:48:46    阅读次数:156
【BZOJ】【1020】【SHOI2008】安全的航线flight
二分/迭代/搜索+剪枝 写三个tag可能是因为从哪个方向来理解都可以吧…… 我完全不会计算几何所以抄了ydc的代码 题解:http://ydcydcy1.blog.163.com/blog/static/21608904020131492229367/ 那篇莫涛的论文:http://pan....
分类:其他好文   时间:2015-04-12 19:15:38    阅读次数:419
hdu 1253 胜利大逃亡
简单空间bfs,开三维数组剪枝1026ms过 #include #include #include #include using namespace std; int a,b,c,t; int re; int mapp[51][51][51]; int dir[6][3]={{0,0,1},{0,0,-1},{1,0,0},{-1,0,0},{0,1,0},{0,-1,0}}; struct...
分类:其他好文   时间:2015-04-10 18:00:37    阅读次数:131
奇偶性剪枝
奇偶剪枝是数据结构的搜索中,剪枝的一种特殊小技巧。 现假设起点为(sx,sy),终点为(ex,ey),给定t步恰好走到终点, s         |         |         |         + — — — e ...
分类:其他好文   时间:2015-04-08 16:29:28    阅读次数:150
【BZOJ3669】NOI2004-魔法森林(神奇的解法)
在一个魔法森林中,有n个节点(n<=50000),m条边(m<=100000),每个节点有两个值ai,bi,1<=ai,bi=ai,B>=bi,求min(A+B)。 本题目的标准解法是LCT(link-cut-tree),这里讨论一种基于搜索算法的解决方法,其编程复杂性和理解难度略优于LC...
分类:其他好文   时间:2015-04-08 15:07:55    阅读次数:155
hdu 1518 Square
关键在于优化剪枝 #include #include #include #include using namespace std; int mapp[20+5],visit[20+5]; int flag; int l,m; void dfs(int s,int x,int num) { visit[s]=1; if(x==l) num++,s=0,x=0; if(num==4) { ...
分类:其他好文   时间:2015-04-08 01:11:02    阅读次数:112
HDU 1175 连连看(bfs + 剪枝)
Problem Description: “连连看”相信很多人都玩过。没玩过也没关系,下面我给大家介绍一下游戏规则:在一个棋盘中,放了很多的棋子。如果某两个相同的棋子,可以通过一条线连起来(这条线不能经过其它棋子),而且线的转折次数不超过两次,那么这两个棋子就可以在棋盘上消去。不好意思,由于我以前没有玩过连连看,咨询了同学的意见,连线不能从外面绕过去的,但事实上这是错的。现在已经酿成大祸,就只能...
分类:其他好文   时间:2015-04-07 17:47:12    阅读次数:132
HDU 1010 Tempter of the Bone DFS 简单题 注意剪枝
题意:一只小狗要刚好在t时刻从起点都到终点,问可不可以。注意剪枝。 1 #include 2 #include 3 #include 4 using namespace std; 5 int maze[9][9]; 6 bool vis[9][9]; 7 int n,m,t; 8 bool ans;...
分类:其他好文   时间:2015-04-05 23:22:08    阅读次数:186
Weka源码学习-J48(一)-决策树的剪枝
#J48.class 1 /** 2 * Generates the classifier. 3 * 4 * @param instances the data to train the classifier with 5 * @throws Exception if cl...
分类:其他好文   时间:2015-04-05 20:17:31    阅读次数:2636
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!