QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#408292#8507. Clever Cell Choicesucup-team191#AC ✓1ms3924kbC++232.4kb2024-05-09 23:23:352024-05-09 23:23:35

Judging History

你现在查看的是最新测评结果

  • [2024-05-09 23:23:35]
  • 评测
  • 测评结果:AC
  • 用时:1ms
  • 内存:3924kb
  • [2024-05-09 23:23:35]
  • 提交

answer

#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
using ll=long long;
using pii=pair<int,int>;
using vi=vector<int>;
using vl=vector<ll>;
#define pb push_back
#define all(a) begin(a),end(a)

const int N=55,MOD=1e9+7;
const char en='\n';
const ll LLINF=1ll<<60;

int n, m, cnt[2];
char c[N][N];
int idx[N][N];
vector <vi> v[2];

int dx[4] = {1, -1, 0, 0};
int dy[4] = {0, 0, 1, -1};

bool ok (int x, int y) {
	return x >= 0 && x < n && y >= 0 && y < m && c[x][y] != '#';
}

void build_graph () {
	v[0].resize(cnt[0]);
	v[1].resize(cnt[1]);
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			if (c[i][j] == '#') continue;
			int tip = (i + j) % 2;
			for (int k = 0; k < 4; k++) {
				int nx = i + dx[k];
				int ny = j + dy[k];
				if (!ok(nx, ny)) continue;
				int sus = idx[nx][ny];
				v[tip][idx[i][j]].push_back(sus);
			}
		}
	}
}

bool find (int j, vector <vi>& g, vi& btoa, vi& vis) {
	if (btoa[j] == -1) return 1;
	vis[j] = 1; int di = btoa[j];
	for (int e : g[di]) {
		if (!vis[e] && find(e, g, btoa, vis)) {
			btoa[e] = di;
			return 1;
		}
	}
	return 0;
}

void dfsMatching (vector <vi>& g, vi& btoa) {
	vi vis;
	for (int i = 0; i < (int)g.size(); i++) {
		vis.assign((int)btoa.size(), 0);
		for (int j : g[i]) {
			if (find(j, g, btoa, vis)) {
				btoa[j] = i;
				break;
			}
		}
	}
	//return (int)btoa.size() - (int)count(btoa.begin(), btoa.end(), -1);
}

void dfs (int i, vector <vi>& g, vi& btoa, vi& vis) {
	if (vis[i]) return;
	vis[i] = 1;
	for (auto j : g[i]) {
		int sus = btoa[j];
		if (sus == -1) continue;
		dfs(sus, g, btoa, vis);
	}
}

int calc (int tip) {
	vi btoa(cnt[!tip], -1);
	dfsMatching(v[tip], btoa);

	vi atob(cnt[tip], -1);
	for (int i = 0; i < (int)btoa.size(); i++) {
		if (btoa[i] != -1) atob[btoa[i]] = i;
	}

	vi vis(cnt[tip], 0);
	for (int i = 0; i < cnt[tip]; i++) {
		if (atob[i] == -1) {
			dfs(i, v[tip], btoa, vis);
		}
	}
	
	int sol = 0;
	for (int i = 0; i < cnt[tip]; i++) {
		if (vis[i] == 1) sol++;
	}
	return sol;
}

int main () {
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cin >> n >> m;
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < m; j++) {
			cin >> c[i][j];
			if (c[i][j] == '#') {
				idx[i][j] = -1;
				continue;
			}
			int tip = (i + j) % 2;
			idx[i][j] = cnt[tip];
			cnt[tip]++;
		}
	}
	build_graph();
	cout << calc(0) + calc(1) << endl;
	return 0;
}




详细

Test #1:

score: 100
Accepted
time: 1ms
memory: 3580kb

input:

3 3
#.#
...
#.#

output:

4

result:

ok 1 number(s): "4"

Test #2:

score: 0
Accepted
time: 1ms
memory: 3524kb

input:

3 3
..#
...
...

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

1 4
...#

output:

2

result:

ok 1 number(s): "2"

Test #4:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

1 5
####.

output:

1

result:

ok 1 number(s): "1"

Test #5:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

1 6
#..###

output:

0

result:

ok 1 number(s): "0"

Test #6:

score: 0
Accepted
time: 0ms
memory: 3764kb

input:

2 5
....#
###.#

output:

3

result:

ok 1 number(s): "3"

Test #7:

score: 0
Accepted
time: 0ms
memory: 3552kb

input:

2 6
...##.
.#.###

output:

4

result:

ok 1 number(s): "4"

Test #8:

score: 0
Accepted
time: 1ms
memory: 3572kb

input:

5 5
##...
##.#.
##.##
##.#.
.##..

output:

7

result:

ok 1 number(s): "7"

Test #9:

score: 0
Accepted
time: 0ms
memory: 3592kb

input:

6 6
...##.
#..#..
......
..#...
#...##
.#....

output:

1

result:

ok 1 number(s): "1"

Test #10:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

10 10
####.#...#
.#.###....
#....#..#.
.....#.#..
##.#..#.#.
..#..##...
.##.#####.
#######.##
.#.#.##..#
.#.###.##.

output:

26

result:

ok 1 number(s): "26"

Test #11:

score: 0
Accepted
time: 0ms
memory: 3528kb

input:

10 10
..#..#.###
.#######.#
.#.####.#.
......####
#..#..#.#.
...#.###.#
#.#...#.#.
.#...#....
...#.#.#.#
...###....

output:

21

result:

ok 1 number(s): "21"

Test #12:

score: 0
Accepted
time: 0ms
memory: 3588kb

input:

15 15
#......#.#.###.
#.##...####..#.
##.....##.##.#.
#.###.#..#...##
....###.##.#.#.
.#..#.###.##.#.
######.#.####.#
.#....#..####..
.....#.###.##..
#..##.###.#####
#.##.#####..###
.#######..##.#.
##....#.##...#.
....#####.##.##
...#.#........#

output:

51

result:

ok 1 number(s): "51"

Test #13:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

15 15
###.#......#...
#.....#.#.###.#
#..#.#.###..#..
.#####.##.#..#.
...#.##.#..#.#.
#.#.###.....###
......#..##....
..##..#.#.#...#
..#..#..#......
....####...#..#
.####..#.#.##.#
###.#..#.#.#...
.#.##.##....##.
.#.#####.#..#.#
#.#.#.##.#.....

output:

61

result:

ok 1 number(s): "61"

Test #14:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

20 20
####....##.#####.##.
...####.##..#.####..
#.#.....#....##..###
###..###.#.#..#..###
##.##..#.##.####....
#...###.##.###.##...
.###...#####.##....#
#...###...##........
##.#.#.#.###.......#
#...##.##.#..##.##..
..##.##.######....##
#.#....#.##.##.##..#
##.....#..#.########
##....##.###...#....
...

output:

95

result:

ok 1 number(s): "95"

Test #15:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

20 20
.##.#.#.#..##..##.#.
..#.##.##.....##..##
.#....##...####..#..
##..###..#.#..##....
....#.##.##.###...##
.#.#.##.#..###....#.
######.#..#....#.#..
.##.###..##..##.###.
#.....#.#..#.##.#.#.
###.#####.##..#.##.#
...###.####.##...#.#
.#.....#.#.#.#..###.
#.#...#####..##.####
..####.##..##.#.#.##
...

output:

109

result:

ok 1 number(s): "109"

Test #16:

score: 0
Accepted
time: 1ms
memory: 3712kb

input:

30 30
###...###....#..#.#.#######...
.##..#.###.#.####.#...#..#.#..
.##..#######..##...#....##...#
..###..#..###...#.##.....#..##
#.#.#.#.#...###.######..#....#
###..##..###.#.###.#.####..#..
.....#...####..####..##.#.##.#
..#...######.##....#..###..###
..#####......#.#...##...#..##.
##..#.#.#.##......

output:

196

result:

ok 1 number(s): "196"

Test #17:

score: 0
Accepted
time: 0ms
memory: 3556kb

input:

30 30
######....###.#..#..###.#.##.#
.#..#...#.##..#.##...#...#####
##.#.##..##.#..###.#.#...####.
.####.###..##..#..#.#####..#.#
....##.##...#...##.####..####.
..###.##.##...##.##.###.####.#
#####......#.#...#..........#.
..#.....###..##.##..##.#.#####
..##...#.##.#.#.#..#.#.#.##...
...#.#.##..###....

output:

196

result:

ok 1 number(s): "196"

Test #18:

score: 0
Accepted
time: 1ms
memory: 3636kb

input:

40 40
......##...#.##..###.##.#.....#.#.#..#.#
#..###...####.####..###.#.#.#..#.##..##.
############.#.#...##..#...#........#.##
##.###.##########...###...####.##..#####
.###.#.##.##....##...#.##.#..#..##.#..#.
##...####.##.###.#.#.##...##..####.#####
#####..##.###.##.#.#.....####..##...##..
.#..###...

output:

290

result:

ok 1 number(s): "290"

Test #19:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

40 40
.####.####.....##.......#....########..#
.#.#....#####..#.##.###..#..#.#...##.#.#
.##.####..#.#...#.######..#.....##.#.##.
.##..##...#...#.#.#..#.###.....#..##.##.
..###.#.#....#######...#.##.##...##...#.
.##..#......##.##########.##.###..#..#.#
###.##.#.##...#.#####...###..##.#.#..###
#.###.....

output:

307

result:

ok 1 number(s): "307"

Test #20:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

50 50
#..#..###.###.####..#..#.##.#.##...#.#...########.
..#.##.##..##..##.##.##.##...#.#.####.#.##...##..#
....##.#.#..#.#.#.###...##.###.#...#.##..#..#..###
#.###.#.##.#......##...#..#..#..##..#####.##.#....
.##.####..##.#..#...##...#..#...##..##.##..#.##...
.###.#..#..####....##...#......##..#.##...

output:

488

result:

ok 1 number(s): "488"

Test #21:

score: 0
Accepted
time: 1ms
memory: 3840kb

input:

50 50
...##..#.#.##...#..##........##..###..##..#......#
.......#.#..#####.##.##.##.###.#.##.#.#..##......#
...##.##.########.##...#...#...#####...###.####.#.
#....###..###.###......##.#####..##.#...#.#...###.
#.##.##...#.#....##..##.##..##.#..####..#####.##..
.##.##.#.##...#.##.#.#....##..#..#.##.#...

output:

494

result:

ok 1 number(s): "494"

Test #22:

score: 0
Accepted
time: 0ms
memory: 3524kb

input:

1 10
.#........

output:

1

result:

ok 1 number(s): "1"

Test #23:

score: 0
Accepted
time: 0ms
memory: 3484kb

input:

1 11
#..........

output:

0

result:

ok 1 number(s): "0"

Test #24:

score: 0
Accepted
time: 1ms
memory: 3508kb

input:

1 21
#.......#............

output:

4

result:

ok 1 number(s): "4"

Test #25:

score: 0
Accepted
time: 0ms
memory: 3512kb

input:

2 12
..#.........
......#.....

output:

0

result:

ok 1 number(s): "0"

Test #26:

score: 0
Accepted
time: 0ms
memory: 3584kb

input:

2 22
....#.................
..........#......#..#.

output:

0

result:

ok 1 number(s): "0"

Test #27:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

33 3
#..
...
...
...
.#.
...
...
...
...
.#.
...
...
...
...
..#
...
...
...
...
...
...
..#
..#
...
...
...
...
...
...
...
.#.
...
.#.

output:

3

result:

ok 1 number(s): "3"

Test #28:

score: 0
Accepted
time: 0ms
memory: 3532kb

input:

42 1
.
.
.
.
.
.
#
.
.
.
.
.
.
.
.
#
.
.
.
.
.
#
.
.
.
.
#
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.

output:

11

result:

ok 1 number(s): "11"

Test #29:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

13 37
##........#..........................
....................#................
..........#.............#............
..............#.....#.....#..........
....#....#.....................##....
....#........#.........#.............
........#.......#....................
....#............##............

output:

221

result:

ok 1 number(s): "221"

Test #30:

score: 0
Accepted
time: 1ms
memory: 3788kb

input:

31 13
.....#......#
........#....
....#.#......
....#........
.............
.#.........#.
......#......
............#
..#.#......#.
.............
.......#.....
.....#.......
..#..........
.##.#........
.#..#........
..........##.
.............
...........##
............#
.............
.......#.#...
...

output:

184

result:

ok 1 number(s): "184"

Test #31:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

44 44
...................#...........#............
.#............#.#..#.#......................
...#....#.........##....#...##..............
.......#....................................
.....##...#...##..........#.................
..##.#...........#.........##........#......
.....#.....................

output:

833

result:

ok 1 number(s): "833"

Test #32:

score: 0
Accepted
time: 0ms
memory: 3908kb

input:

49 46
......##.................#....................
...#.................#.....#..#..........#.#..
#.....#...............#......##....#.....#....
..........#............##...................##
...#......#.#..............###..#..........#..
..................................#...........
...........#...

output:

956

result:

ok 1 number(s): "956"

Test #33:

score: 0
Accepted
time: 1ms
memory: 3640kb

input:

50 50
..#..#................#.#.......#.................
#...........................#..#..................
...#..............#....#...............#..........
.........#..........#........................#....
...#....#..........#..#.#................##..#....
...#.........#.#.#..................#.....

output:

1020

result:

ok 1 number(s): "1020"

Test #34:

score: 0
Accepted
time: 0ms
memory: 3576kb

input:

1 7
.......

output:

4

result:

ok 1 number(s): "4"

Test #35:

score: 0
Accepted
time: 1ms
memory: 3532kb

input:

1 10
..........

output:

0

result:

ok 1 number(s): "0"

Test #36:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

31 35
...................................
...................................
...................................
...................................
...................................
...................................
...................................
...................................
.........

output:

543

result:

ok 1 number(s): "543"

Test #37:

score: 0
Accepted
time: 1ms
memory: 3632kb

input:

33 33
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.................................
.........................

output:

545

result:

ok 1 number(s): "545"

Test #38:

score: 0
Accepted
time: 1ms
memory: 3872kb

input:

42 42
..........................................
..........................................
..........................................
..........................................
..........................................
..........................................
.......................................

output:

0

result:

ok 1 number(s): "0"

Test #39:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

47 48
................................................
................................................
................................................
................................................
................................................
................................................
...

output:

0

result:

ok 1 number(s): "0"

Test #40:

score: 0
Accepted
time: 1ms
memory: 3840kb

input:

50 50
...##.#......#....#............#...........#......
...#........#.............#.....##...#.....#.....#
.......#..#..#.#...........#...............#......
.......#........#......#.................#......#.
#....................................#...#........
........#.................#.........#.....

output:

909

result:

ok 1 number(s): "909"

Test #41:

score: 0
Accepted
time: 1ms
memory: 3624kb

input:

50 50
.##...###......#......#.......###.....#.#..#.#....
.#...#.####........#.##......#...##..#..#.........
..###..#....#.......#..##.......#...#.....#...#..#
##.#....#...#...#...##.#..##.#.#..#.......#...##..
##.#..#........#.#..#.##.....#..##.....##..#...#..
.............#..#....##.....#..##.....#...

output:

688

result:

ok 1 number(s): "688"

Test #42:

score: 0
Accepted
time: 1ms
memory: 3764kb

input:

50 50
#....#.####.###........##.#...#......#..##.##.##..
#####.#.#.######..##.###.....#.#.#...#.###.#.#....
.#.#####.#..##.#...#....#.##...#.##..####.#.#...##
#.#...##..##....#....######.##.####...#.##.##.####
#..###.....#.##..###...###.##...#..####....##.##.#
#....#.#...#.##...###..###....#.###..#....

output:

536

result:

ok 1 number(s): "536"

Test #43:

score: 0
Accepted
time: 1ms
memory: 3628kb

input:

50 50
#####.#####.###..###..#######.##.#.####.#.#.###.##
###.#.####.##...##.#.##.##..####.######.#..###.#..
###...####.########..###.###.###..###.#####..#####
###########..##.###..#..#####..#....##..######.#.#
#######.####.#.#####.#...######..#.#####.#.#######
####.#.##.#######..######.##.###.##.###...

output:

371

result:

ok 1 number(s): "371"

Test #44:

score: 0
Accepted
time: 1ms
memory: 3796kb

input:

50 50
..##.####.#..#.##..#.#.#####..####.########.###.##
###.###..#.##.##..########...#########..##########
#########.#######.###..####################..#####
#######.##.###.###.###.#..####.#####...###..###.#.
##.#.##############.###########.####...##########.
.....#.#.#####.#...#.##################...

output:

299

result:

ok 1 number(s): "299"

Test #45:

score: 0
Accepted
time: 0ms
memory: 3772kb

input:

50 50
############.########################.###########.
####.##########.#############.#############.######
#####.#######.###############.#############.#.##.#
..#.##.#####..###.###########.########.####.######
###############.#.########.##############.######..
######.#################.#..##.########...

output:

189

result:

ok 1 number(s): "189"

Test #46:

score: 0
Accepted
time: 1ms
memory: 3612kb

input:

43 44
.................#....#..#...............##.
....#..#.............................#......
.............#.....................#.#......
.#.....#......#...............#.............
#...............#...#...............#.......
.#.....#..#...........#.......#.............
..#........................

output:

776

result:

ok 1 number(s): "776"

Test #47:

score: 0
Accepted
time: 1ms
memory: 3568kb

input:

15 49
.##..#........#....#....##.....#..#.......##...#.
...#.....##....##...#.#...........#..#.........#.
#..#.........##.....#.#..#.....#.#.#..#......#...
.................#...........#.....#...........#.
..#..#.....##...#......#....#.....#........#..#..
#.#.......#..........#..#...#..................

output:

218

result:

ok 1 number(s): "218"

Test #48:

score: 0
Accepted
time: 0ms
memory: 3768kb

input:

5 10
#..#......
.#....##..
..###...##
..#...#..#
#....#....

output:

3

result:

ok 1 number(s): "3"

Test #49:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

49 49
#.#.##...#.....#..##..##..##....##..###....##.##.
####.#....#......##.........##...##......#.#...##
..#...#.##....#......###...##..#.##.#.......##.#.
.....###..#....#.##.#....####..##..#..##....#..#.
#####..#...#....#.######......#..#....###..#.###.
.#.#.....###..#...#..#..#####...#.##......#....

output:

530

result:

ok 1 number(s): "530"

Test #50:

score: 0
Accepted
time: 0ms
memory: 3784kb

input:

22 22
###.#.#######.###.##.#
..###.##...#.#.#..#..#
.####.####.###.#.....#
#####..#.##.###..#.#..
###.#.#.#.#...###.###.
...###....##..##.....#
.#..##.#......#.#..#.#
.###.##.#.....#...#.#.
##..#.#######.##...#..
##...###...##.#..#####
##.#..##.##....##.###.
..#.##...##.###.##.##.
#####.##.#.#.#.##....

output:

105

result:

ok 1 number(s): "105"

Test #51:

score: 0
Accepted
time: 0ms
memory: 3488kb

input:

13 31
.###..##.#..##.#..#.#..#.###..#
.#...######....##.####.#..#.###
##..##..######...#.#####..#####
###.######.#..#.#.##..##.###.#.
##############.###..###.##.#.#.
##..##...#..#..#####.##.##....#
.###.#.##..#.....#...#..##.##.#
####.##.....######.##.#.##.#..#
...####.#.###.###.##.#..#.#.#..
..#..#...

output:

56

result:

ok 1 number(s): "56"

Test #52:

score: 0
Accepted
time: 1ms
memory: 3544kb

input:

33 33
#.###.##..####.##.##..#.##..#####
#.#.####.##.####.#####.##.####.##
#####...#.##.###########.#.####.#
###.##....##.#######.####.#######
##################.##..#######..#
##.###.#.###.##########.###.##..#
.#..#####.#####.#####.####..#.###
.##.#.###.####.#####.####.###.##.
.###.#..############.#...

output:

160

result:

ok 1 number(s): "160"

Test #53:

score: 0
Accepted
time: 1ms
memory: 3676kb

input:

50 50
......#.....................................######
......#.....................................#.....
......#.....................................#.....
......#.....................................#.....
......#.....................................#.....
......#...................................

output:

267

result:

ok 1 number(s): "267"

Test #54:

score: 0
Accepted
time: 0ms
memory: 3712kb

input:

50 50
......#..#....###.....#.#......#..................
..#....#......#...................................
.###..........#...#.....#......#.....#...#.##.....
#.........#...#.....#.............................
#.............#..#..#.....#.....#.........##......
..............#..#....#....#........#.....

output:

862

result:

ok 1 number(s): "862"

Test #55:

score: 0
Accepted
time: 1ms
memory: 3888kb

input:

50 50
...#..............#.........#.......#........#....
.........#.#.#..#...............#.#..............#
.............#...#....##......#.#..............#..
.#.#...#.......##...........##...#....#...........
.#.#....#..#.......#.#....#.#...........#.........
..##.......#..........#...#.#....#.#......

output:

926

result:

ok 1 number(s): "926"

Test #56:

score: 0
Accepted
time: 1ms
memory: 3924kb

input:

50 50
............................................#.....
............................................#.....
............................................#.....
............................................#.....
............................................#.....
..........................................

output:

406

result:

ok 1 number(s): "406"

Test #57:

score: 0
Accepted
time: 1ms
memory: 3740kb

input:

50 50
.........#########################################
..................................................
..................................................
..................................................
###################################...............
..................................#.......

output:

664

result:

ok 1 number(s): "664"

Test #58:

score: 0
Accepted
time: 1ms
memory: 3904kb

input:

50 50
.#........................................#.#.##..
.#........#...............................#...##..
##........................................#...##..
.#.......................#.............#..#...##..
###########################################...##..
..........................................

output:

650

result:

ok 1 number(s): "650"

Test #59:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

50 50
..#...#.....#.........#...#.#....#..#...#.........
............#..#...#....##.........#....#..#......
............#.......#..................##....#####
...#........#................#..........#....#..#.
............#....#.##........#....#.....#....#....
...##...#...###########################...

output:

939

result:

ok 1 number(s): "939"

Test #60:

score: 0
Accepted
time: 1ms
memory: 3596kb

input:

50 50
.#######..####.....##..#....#.#.##.####...#..#...#
#.##..###.####.###.#.........####.##....#.....##..
##.#.##..####.####.##.##..#...#.#......###.#..##..
###..#.#..#####.#####....####...#.#########...#.#.
.#.###.##.###...##.##..#.##.#...#..#.###.######..#
###..##..###..#.#..#.####.#..###.#..#.....

output:

429

result:

ok 1 number(s): "429"

Test #61:

score: 0
Accepted
time: 1ms
memory: 3680kb

input:

50 50
..##................................#..#.....#....
..##................................#..#.....#....
..##................................#..#.....#....
..#####.............................#..#.....#....
..##..#.............................#..#.....#....
..##..#.............................#.....

output:

0

result:

ok 1 number(s): "0"

Test #62:

score: 0
Accepted
time: 1ms
memory: 3732kb

input:

50 50
.............................#......#...#...#.....
.............................#......#...#...#.....
.............................#......#...#...#.....
.............................#......#...#...#.....
.............................#......#...#...#.....
.............................#......#.....

output:

264

result:

ok 1 number(s): "264"

Test #63:

score: 0
Accepted
time: 1ms
memory: 3664kb

input:

50 50
.........#..#....................##..#......#.....
.........#..#....................##..#......#.....
.........#..#....................##..#......#.....
.........#..#....................##..#...#..#.....
.........#..#....................##..#......#.....
.........#..#....................##..#....

output:

763

result:

ok 1 number(s): "763"

Test #64:

score: 0
Accepted
time: 1ms
memory: 3884kb

input:

50 50
.....#....#.###.#.....#...........................
.....#....#.###.#.....#......................#####
.....#....#.###.#.....############################
.....#....#.###.#####...#.........................
.....#....#.###.#...#...#.........................
.....#....#.###.#...#...#.................

output:

365

result:

ok 1 number(s): "365"

Test #65:

score: 0
Accepted
time: 1ms
memory: 3644kb

input:

50 50
..........................................##.#.#..
..........................................##.#.#..
############################################.#.#..
..#.........#................#............##.#.#..
..#.........#................#............##.#.#..
#############................#............

output:

301

result:

ok 1 number(s): "301"

Extra Test:

score: 0
Extra Test Passed