很典型的dfs题,但是涉及到很多的剪枝 。奇偶剪枝:是数据结构的搜索中,剪枝的一种特殊小技巧。现假设起点为(sx,sy),终点为(ex,ey),给定t步恰好走到终点,s|||+———e如图所示(“|”竖走,“—”横走,“+”转弯),易证abs(ex-sx)+abs(ey-sy)为此问题类中任意情况下...
分类:
其他好文 时间:
2015-04-17 17:52:48
阅读次数:
91
奇偶剪枝是数据结构的搜索中,剪枝的一种特殊小技巧。
现假设起点为(sx,sy),终点为(ex,ey),给定t步恰好走到终点,
s
|
|
|
+
—
—
—
e
...
分类:
其他好文 时间:
2015-04-08 16:29:28
阅读次数:
150
这题是深搜的典型题,要在时间 t 内准确到达终点,处理不好要么 wa 要么 TLE。有两个很重要的剪枝:一是奇偶剪枝,必须提前判断好 'S'和'D' 之间的曼哈顿距离和时间 t 是否同奇偶,否则会 TLE;二是判断 '.' 的数量是否大于或等于 t-1,这个能使程序快很多,但不是必要的,我试了下.....
分类:
其他好文 时间:
2015-04-05 14:29:33
阅读次数:
122
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1010题目描述:在n*m的矩阵中,有一起点和终点,中间有墙,给出起点终点和墙,并给出步数,在该步数情况下走到终点,走过的点不能再走;题目要点:dfs+奇偶剪枝;输入; 本题用dfs可以做出结果,但是会.....
分类:
其他好文 时间:
2015-03-11 00:24:27
阅读次数:
227
Problem Description:
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He...
分类:
其他好文 时间:
2015-03-02 19:07:09
阅读次数:
178
Problem Description
The doggie found a bone in an ancient maze, which fascinated him a lot. However, when he picked it up, the maze began to shake, and the doggie could feel the ground sinking. He realized that the bone was a trap, and he tried desperately...
分类:
其他好文 时间:
2015-02-12 16:21:54
阅读次数:
129
ChocolateTime Limit: 2000MSMemory Limit: 65536KTotal Submissions: 8800Accepted: 2306Special JudgeDescriptionIn 2100, ACM chocolate will be one of the ...
分类:
其他好文 时间:
2015-02-07 22:52:16
阅读次数:
217
一:题意描述本题大致意思是讲给定一个迷宫(N*M),起点(s)和终点(D),现在要求在给定的步数(T)下从起点走到终点。要求是每一个点只能走一次。二:题目分析考虑到数据比较小,我们完全可以利用dfs去暴力出来,但是对于本题我想说一个很特别的技巧就是奇偶剪枝:对于任何一个可能的路径,我们都可以看做是S...
分类:
其他好文 时间:
2015-01-27 00:16:32
阅读次数:
221
Tempter of the BoneTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 75141Accepted Submission(s): 20...
分类:
其他好文 时间:
2014-12-16 20:53:59
阅读次数:
218
Tempter of the Bone
Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)
Total Submission(s): 74916 Accepted Submission(s): 20481
Problem Description
The ...
分类:
其他好文 时间:
2014-12-12 07:47:47
阅读次数:
201