先预处理出所有连通块,对于每一个*,看他四周的连通块即可 #include<cstdio> #include<cstring> #include<queue> #include<algorithm> using namespace std; +; char s[maxn][maxn]; int Map[maxn][maxn]; int n,m; ][]; int Belong[maxn*maxn];//每个点属于哪个联通快 int tot[maxn*maxn…
C. The Labyrinth 题目连接: http://www.codeforces.com/contest/616/problem/C Description You are given a rectangular field of n × m cells. Each cell is either empty or impassable (contains an obstacle). Empty cells are marked with '.', impassable cells are…
D. Theseus and labyrinth 题目连接: http://www.codeforces.com/contest/676/problem/D Description Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of size n × m and consists of blocks of size 1…
Codeforces Round #354 (Div. 2) Problems # Name A Nicholas and Permutation standard input/output 1 s, 256 MB x3384 B Pyramid of Glasses standard input/output 1 s, 256 MB x1462 C Vasya and String standard input/output 1 s, 256 MB x1393…
D. Theseus and labyrinth 题目链接:http://codeforces.com/contest/676/problem/D Theseus has just arrived to Crete to fight Minotaur. He found a labyrinth that has a form of a rectangular field of sizen × m and consists of blocks of size 1 × 1. Each block o…
E. Two Labyrinths Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/E Description A labyrinth is the rectangular grid, each of the cells of which is either free or wall, and it's possible to move only between free…
目录 Codeforces 1064 A.Make a triangle! B.Equations of Mathematical Magic C.Oh Those Palindromes D.Labyrinth(BFS) E.Dwarves,Hats and Extrasensory Abilities(交互 二分) F.Candies for Children D.Labyrinth E.Dwarves,Hats and Extrasensory Abilities Codeforces 1…
Labyrinth http://codeforces.com/problemset/problem/1064/D time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output You are playing some computer game. One of its levels puts you in a maze consistin…
传送门: http://codeforces.com/problemset/problem/616/C C. The Labyrinth time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given a rectangular field of n × m cells. Each cell is either em…