BFS
文章平均质量分 56
Freeman_sason
SSL毕业学生
展开
-
SSLOJ——P1738.水洼的大小
水洼的大小 题目描述: 解法: 1.bfs + dfs 2.二维并查集 思路都差不多,求出每个联通水洼的大小,并做上标记,在输出时上下左右相加就好了。 CODE1: #include<iostream> #include<queue> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> #define INF 0x3f3f3f3f #d原创 2022-01-14 22:11:52 · 472 阅读 · 0 评论 -
C/C++噩梦
噩梦 题意: 给定一张 N×M 的地图,地图中有 1 个男孩,1 个女孩和 2 个鬼。 字符 . 表示道路,字符 X 表示墙,字符 M 表示男孩的位置,字符 G 表示女孩的位置,字符 Z 表示鬼的位置。 男孩每秒可以移动 3 个单位距离,女孩每秒可以移动 1 个单位距离,男孩和女孩只能朝上下左右四个方向移动。 每个鬼占据的区域每秒可以向四周扩张 2 个单位距离,并且无视墙的阻挡,也就是在第 k 秒后所有与鬼的曼哈顿距离不超过 2k 的位置都会被鬼占领。 注意: 每一秒鬼会先扩展,扩展完毕后男孩和女孩才可以原创 2021-07-19 17:16:18 · 203 阅读 · 0 评论 -
P1825 [USACO11OPEN]Corn Maze S
Corn Maze S(玉米田迷宫) This past fall, Farmer John took the cows to visit a corn maze. But this wasn’t just any corn maze: it featured several gravity-powered teleporter slides, which cause cows to teleport instantly from one point in the maze to another. The原创 2021-02-28 22:42:54 · 225 阅读 · 0 评论