In an n?mn?m maze, the right-bottom corner is the exit (position (n,m)(n,m) is the exit). In every position of this maze, there is either a 00 or a 11 ...
分类:
其他好文 时间:
2018-07-24 14:05:15
阅读次数:
139
bfs,多校,HDU5335
In an maze, the right-bottom corner is the exit (position is the exit). In every position of this maze, there is either a or a written on it.
An explorer gets lost in this grid. His position now is , and he wants to go to the exit. Sin...
分类:
其他好文 时间:
2015-08-27 16:45:12
阅读次数:
227
题意:
给出01矩阵,问从(1,1)到(n,m)走过的路中所有01组成的二进制字符串所代表的数字最小是多少。分析:
首先前缀0是要去掉的,另外发现只有不断地向下和向右走就能达到最短路。所以首先dfs找到所有能走的0的位置,去掉前缀0.然后bfs向右下角进行,有0 的地方就走0,不走1,没有任何0的情况下才走1.如果有多个0就都走,看谁后面还有0.如果没有0,就全部的1都...
分类:
其他好文 时间:
2015-08-18 16:18:18
阅读次数:
130
题意:大致意思是给一个n*m的01矩阵,起点为左上方(1,1),终点为右下方(n,m),求从左上方到右下方字典序自小的路径,如果路径都为0,则输出0。
分析:首先字典序最小,先要满足路径最短,再满足路径的值最小,路径最短的毫无疑问是越靠下或者越靠右,而且如果路径的前面为0,则可以认为是以第一个非0的点的为起点。因此这题可以转化为:先找出以起点为中心的连续为零的集合,再在其中找出x+y最大...
分类:
其他好文 时间:
2015-08-03 11:35:00
阅读次数:
153
Problem DescriptionIn ann?mmaze, the right-bottom corner is the exit (position(n,m)is the exit). In every position of this maze, there is either a0or ...
分类:
其他好文 时间:
2015-08-01 15:40:13
阅读次数:
180
Walk OutTime Limit: 2000/1000 MS (Java/Others)Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1977Accepted Submission(s): 373Problem Des...
分类:
其他好文 时间:
2015-07-31 19:52:59
阅读次数:
196
http://acm.hdu.edu.cn/showproblem.php?pid=5335
Problem Description
In an n?m maze,
the right-bottom corner is the exit (position (n,m) is
the exit). In every position of this maze, the...
分类:
其他好文 时间:
2015-07-31 14:52:22
阅读次数:
174
题目:http://acm.hdu.edu.cn/showproblem.php?pid=5335
题意:给你N*M的01矩阵,求从(1,1)位置走到(N,M)的最小二进制数,输出不含前导0。
分析:为了不让当前位置向上走,可以先将所有的起点预处理出来。当(1,1)为1,那么起点只有一个,就是(1,1);当(1,1)为0,起点就是从(1,1)可达的并且只走0的这些点,然后把这些起点离终点最近的...
分类:
其他好文 时间:
2015-07-31 10:33:01
阅读次数:
135
题目链接:
HDu5335
题意:
1000X1000的地图, 问通过四个方向从(1,1)走到(1000,1000)所经过的最小二进制序列是多少.
解题思路:
首先应该通过bfs找到 (1,1)能走到的值为0且最接近右下角的位置 (x+y值最大 ,有多个全部保存)
这样就能保证接下来找的序列是最短的
接下来每一步的...
分类:
其他好文 时间:
2015-07-30 21:24:44
阅读次数:
485