--in--
20
4 4
####
#...
#.##
#.##
5 5
#.###
#..##
##..#
#.#.#
###.#
1 1
.
5 1
#
#
.
.
#
2 2
#.
.#
3 4
#..#
#.##
#.##
10 10
##########
.....#.#.#
#.##.##..#
##.#...#.#
#..#...#.#
#......###
######.###
######.###
######..##
#######.##
6 5
##.##
#..##
#...#
###.#
#...#
###.#
9 9
#########
..#.#####
#.#.#.#.#
#....##.#
###...###
#..##...#
#.#...#..
#.#..#..#
#########
6 8
...#.###
####..#.
.#####.#
.#..##.#
##.####.
..###.##
8 6
..##..
###...
#....#
.#.##.
.##.#.
.#.##.
.#..#.
##....
14 8
##.#####
#......#
##.##.##
###...##
##...#..
#..#.#.#
###....#
###.####
#####.##
###..#.#
######.#
#.#..###
#....###
########
19 10
...###.#..
.#.###.###
..........
.#.#####.#
#.#.#.#.#.
..##.####.
#.##.#..##
##..#.#...
#..#.#..#.
.##.###..#
......#.##
#####..#..
#####.#.#.
.##.###.##
##...###.#
#....##..#
##...#....
#.#.##..##
.#..#.##..
15 10
.#.##....#
....#....#
#.##.##.#.
#.....###.
.#.###.###
...#.##.#.
.###..#.##
##..#.#..#
#####..#..
#..#.##.##
..#....#.#
...#....##
####.#.###
...##..###
.#..####.#
11 6
######
..####
#.#..#
#..#.#
##...#
####.#
#....#
#.##.#
#...##
#.#.##
#.####
10 5
#..#.
#.#..
.###.
#.#.#
.###.
.###.
#....
.##.#
.#...
....#
13 20
######.#############
#......###..##...#.#
#.#.##.#....##..####
#.#..###.##...##.#.#
#..#.###..#.#....###
##...#...#.....##.##
##.##..#..#...#.#..#
##....###...###.##.#
#..###.#........##.#
###.#.....#...#..#.#
#...####.#####..####
#..#.#..##...##..#.#
################.###
7 9
#####.###
####...##
#....####
##.##.#.#
##.#...##
##....#.#
####.####
17 15
...#.#.....##..
#.##.#.##......
.##.#....#.####
.####.....##.#.
##..#.#..####..
#.....#.#.##..#
##..#.#..#####.
.###.#.#..#.#..
#..####...####.
###.###.##.#.#.
###.#..#.##.###
#.####...##.###
##.####..#.#.#.
#.##..#.###.#..
#.######.#.....
.###.#.#.#..#.#
..#.#.#.###....
14 9
#########
#######.#
#........
###..##.#
##....###
#####..##
#..###..#
##.....##
##.#.##.#
##.#.#..#
##.#.####
#..##...#
##...####
####.####
--out--
1
1
0
1
0
0
----code----
// In Practice, You should use the statndard input/output
// in order to receive a score properly.
// Do not use file input and output. Please be very careful.
#include<iostream>
using namespace std;
int m,n,sl;
struct node{
int r;
int c;
};
int visit[21][21];
char arr[21][21];
node q[500];
node qt[500];
void input(){
cin>>m>>n;
char s;
sl = -1;
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
cin>>s;
arr[i][j] = s;
if (i == 0 || j == 0 || i == m - 1 || j == n - 1)
{
if (s == '.'){
sl++;
q[sl].r = i;
q[sl].c = j;
}
}
}
}
}
void init(){
for (int i = 0; i < m; i++)
{
for (int j = 0; j < n; j++)
{
if (arr[i][j] == '#')
{
visit[i][j] == 1;
}
else
{
visit[i][j] = 0;
}
}
}
}
bool bfs(){
//reset mang visit
for (int z = 0; z <= sl; z++)
{
init();
int rear = 0;
int head = -1;
while ( head <= rear )
{
head++;
int hang = q[head].r;
int cot = q[head].c;
for (int i = 0; i < length; i++)
{
}
}
}
return false;
}
int main(int argc, char** argv)
{
int test_case;
int T;
freopen("Text.txt", "r", stdin);
cin >> T;
for(test_case = 1; test_case <= T; ++test_case)
{
input();
if (!bfs())
{
cout << "invalid" << endl;
continue;
}
cout << "valid" << endl;
}
return 0;//Your program should return 0 on normal termination.
}