Tempter of the BoneTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 146539 Accepted Submission(s): 39069 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 to get out of this maze. Input The input consists of multiple test cases. The first line of each test case contains three integers N, M, and T (1 < N, M < 7; 0 < T < 50), which denote the sizes of the maze and the time at which the door will open, respectively. The next N lines give the maze layout, with each line containing M characters. A character is one of the following: Output For each test case, print in one line "YES" if the doggie can survive, or "NO" otherwise. Sample Input
4 4 5 S.X. ..X. ..XD .... 3 4 5 S.X. ..X. ...D 0 0 0 Sample Output
NO YES Author ZHANG, Zheng Source 思路:这道题直接暴力dfs肯定是TLE的,于是剪枝加回溯,剪枝可以了解一下奇偶剪枝, 现在说正点,本来这道题看着板子应该几下就搞定的,然而。。。。。。由于代码的不规范,debug调了一个多小时(也水了10多发tle),hdu也是有点骚,刚开始输出的大小写都不对都是TLE,果然是玄学啊,最后还是要感谢学长这么多事情还得抽空帮我找bug,十分感谢 不规范的地方我会在代码中注释,希望广大同胞们不要犯类似错误,以我为戒 代码: #include<bits/stdc++.h> |
hdu1010 Tempter of the Bone 深搜dfs(论代码规范的重要性)
猜你喜欢
转载自blog.csdn.net/cloudy_happy/article/details/81334850
今日推荐
周排行