随笔分类 -  ACM_搜索题

摘要:这题网上都是用DFS做的,我也不知道怎么用BFS做的。。。有个注意点,就是一步也走不动的时候,输出1Problem DescriptionThere is a rectangular room, covered with square tiles. Each tile is colored either red or black. A man is standing on a black tile. From a tile, he can move to one of four adjacent tiles. But he can't move on red tiles, he can 阅读全文
posted @ 2013-06-11 22:30 瓶哥 阅读(179) 评论(0) 推荐(0)
摘要:花3小时打上的注释,分享给大家。。 1 #include 2 #include 3 const int MAXR = 20; 4 const int MAXC = 310; 5 const int MAXN = MAXR * MAXC + MAXC; 6 const int INF = MAXR * 10; 7 8 int n, m; 9 int L[MAXN], R[MAXN], U[MAXN], D[MAXN]; 10 int C[MAXN], O[MAXN], S[MAXN], H[MAXR]; 11 int nodeNumber; 12 13 void ini... 阅读全文
posted @ 2013-06-11 18:14 瓶哥 阅读(297) 评论(0) 推荐(0)
摘要:Problem DescriptionIgnatius被魔王抓走了,有一天魔王出差去了,这可是Ignatius逃亡的好机会.魔王住在一个城堡里,城堡是一个A*B*C的立方体,可以被表示成A个B*C的矩阵,刚开始Ignatius被关在(0,0,0)的位置,离开城堡的门在(A-1,B-1,C-1)的位置,现在知道魔王将在T分钟后回到城堡,Ignatius每分钟能从一个坐标走到相邻的六个坐标中的其中一个.现在给你城堡的地图,请你计算出Ignatius能否在魔王回来前离开城堡(只要走到出口就算离开城堡,如果走到出口的时候魔王刚好回来也算逃亡成功),如果可以请输出需要多少分钟才能离开,如果不能则输出-1 阅读全文
posted @ 2013-06-10 21:07 瓶哥 阅读(216) 评论(0) 推荐(0)
摘要:Problem DescriptionIgnatius had a nightmare last night. He found himself in a labyrinth with a time bomb on him. The labyrinth has an exit, Ignatius should get out of the labyrinth before the bomb explodes. The initial exploding time of the bomb is set to 6 minutes. To prevent the bomb from explodin 阅读全文
posted @ 2013-06-10 21:06 瓶哥 阅读(197) 评论(0) 推荐(0)
摘要:优先队列,这道题被坑了,心情不好。Problem DescriptionAngel was caught by the MOLIGPY! He was put in prison by Moligpy. The prison is described as a N * M (N, M 2 #include 3 #include 4 #include 5 #define MAX 200 6 using namespace std; 7 typedef struct node 8 { 9 int x,y;10 int move;11 12 }point;13 point ... 阅读全文
posted @ 2013-06-09 21:07 瓶哥 阅读(254) 评论(0) 推荐(1)
摘要:好吧,BFS用模版还是比较好理解的。这代码能AC- -Problem DescriptionYou're in space.You want to get home.There are asteroids.You don't want to hit them.InputInput to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, an 阅读全文
posted @ 2013-06-07 23:44 瓶哥 阅读(222) 评论(1) 推荐(0)
摘要:Problem DescriptionYou're in space.You want to get home.There are asteroids.You don't want to hit them.InputInput to this problem will consist of a (non-empty) series of up to 100 data sets. Each data set will be formatted according to the following description, and there will be no blank li 阅读全文
posted @ 2013-06-03 19:02 瓶哥 阅读(347) 评论(1) 推荐(1)