QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#406096#137. Wall Making GameI_Love_Sonechka#AC ✓41ms4496kbC++171.6kb2024-05-06 20:12:292024-05-06 20:12:31

Judging History

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

  • [2024-05-06 20:12:31]
  • 评测
  • 测评结果:AC
  • 用时:41ms
  • 内存:4496kb
  • [2024-05-06 20:12:29]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

// c++ short types
#define vt vector
typedef long long ll;
typedef long double ld;

void whattime() { cout << "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl; }
const int inf = 1e9;
const int mod = 998244353;
bool debug = false;

const int nmax = 20;
int dp[nmax][nmax][nmax][nmax];

void solve() {
	memset(dp, -1, sizeof(dp));
	int n, m; cin >> n >> m;
	vt<string> s(n);
	for(auto &x: s) {
		cin >> x;
	}
	const int k = 3 * n * m;
	auto Dfs = [&](auto self, int a, int b, int c, int d) {
		if(a > b || c > d) {
			return 0;
		}
		if(dp[a][b][c][d] != -1) {
			return dp[a][b][c][d];
		}
		vt<int> cnt(k, 0);
		int kol = 0;
		for(int x = a; x <= b; ++x) {
			for(int y = c; y <= d; ++y) if(s[x][y] != 'X') {
				++kol;
				int value = self(self, a, x-1, c, y-1) ^ self(self, a, x-1, y + 1, d) ^ self(self, x+1, b, c, y-1) ^ self(self, x + 1, b, y + 1, d);
				if(a < b and c < d) {
//					cout << "value=" << value << " " << cnt[0] << "@\n";
				}
				if(value < k) {
					cnt[value] ++;
				}
			}
		}
		int mex = 0;
		if(kol) {
			while(cnt[mex]) {
				mex++;
			}
		}
//		for(auto x: {a,b,c,d}) {
//			cout << x << " ";
//		}
//		cout << " mex=" << mex << "\n";
		return dp[a][b][c][d] = mex;
	};
	if(Dfs(Dfs, 0, n-1, 0, m-1)) {
		cout << "First\n";
	} else {
		cout << "Second\n";
	}
}

int main()
{
	ios::sync_with_stdio(false); cin.tie(nullptr);
	int tt = 1;
	if(debug) {
		tt = 1e3;
	} else {
//		cin >> tt;
	}
	for(int t = 0; t < tt; ++t) {
		solve();
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 5
..X..
.....
.....

output:

First

result:

ok single line: 'First'

Test #2:

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

input:

2 5
.....
.....

output:

First

result:

ok single line: 'First'

Test #3:

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

input:

3 3
...
...
...

output:

First

result:

ok single line: 'First'

Test #4:

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

input:

3 1
.
.
.

output:

First

result:

ok single line: 'First'

Test #5:

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

input:

4 4
....
...X
....
....

output:

Second

result:

ok single line: 'Second'

Test #6:

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

input:

3 3
...
.X.
...

output:

First

result:

ok single line: 'First'

Test #7:

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

input:

5 2
..
X.
.X
..
..

output:

First

result:

ok single line: 'First'

Test #8:

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

input:

3 3
.X.
X..
...

output:

First

result:

ok single line: 'First'

Test #9:

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

input:

4 2
XX
XX
..
XX

output:

First

result:

ok single line: 'First'

Test #10:

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

input:

2 2
..
..

output:

Second

result:

ok single line: 'Second'

Test #11:

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

input:

4 1
.
.
.
X

output:

First

result:

ok single line: 'First'

Test #12:

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

input:

2 1
.
.

output:

First

result:

ok single line: 'First'

Test #13:

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

input:

3 4
..X.
X...
X.XX

output:

First

result:

ok single line: 'First'

Test #14:

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

input:

3 1
X
X
X

output:

Second

result:

ok single line: 'Second'

Test #15:

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

input:

2 1
.
X

output:

First

result:

ok single line: 'First'

Test #16:

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

input:

3 4
.X..
....
.X.X

output:

First

result:

ok single line: 'First'

Test #17:

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

input:

2 3
XX.
.X.

output:

First

result:

ok single line: 'First'

Test #18:

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

input:

2 4
X...
X.XX

output:

First

result:

ok single line: 'First'

Test #19:

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

input:

5 3
X..
.XX
XX.
.X.
XXX

output:

First

result:

ok single line: 'First'

Test #20:

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

input:

4 4
X.XX
....
.XXX
XXXX

output:

First

result:

ok single line: 'First'

Test #21:

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

input:

4 3
..X
XX.
..X
.X.

output:

First

result:

ok single line: 'First'

Test #22:

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

input:

3 4
XXXX
XXXX
XXXX

output:

Second

result:

ok single line: 'Second'

Test #23:

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

input:

4 1
X
X
X
X

output:

Second

result:

ok single line: 'Second'

Test #24:

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

input:

3 2
XX
X.
XX

output:

First

result:

ok single line: 'First'

Test #25:

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

input:

4 3
...
X.X
XXX
X.X

output:

First

result:

ok single line: 'First'

Test #26:

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

input:

4 3
XXX
XXX
X..
.XX

output:

Second

result:

ok single line: 'Second'

Test #27:

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

input:

2 3
XXX
X.X

output:

First

result:

ok single line: 'First'

Test #28:

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

input:

3 3
XXX
X.X
.XX

output:

Second

result:

ok single line: 'Second'

Test #29:

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

input:

4 4
.XXX
.XXX
XXXX
XXXX

output:

First

result:

ok single line: 'First'

Test #30:

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

input:

1 2
XX

output:

Second

result:

ok single line: 'Second'

Test #31:

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

input:

7 14
..............
........X.....
.....X........
.X............
..............
...X....XX....
.......X......

output:

First

result:

ok single line: 'First'

Test #32:

score: 0
Accepted
time: 2ms
memory: 4172kb

input:

9 13
X.....XX.....
......X..X...
.........X...
..........X..
.............
...........X.
....X........
X..X....X....
.X....XX.....

output:

First

result:

ok single line: 'First'

Test #33:

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

input:

10 8
..X.X...
.XX.....
X....X..
.X......
X.XXXX..
...X...X
........
XX...X.X
X...X...
........

output:

First

result:

ok single line: 'First'

Test #34:

score: 0
Accepted
time: 2ms
memory: 4164kb

input:

11 11
.X..XX...XX
XX......XX.
.X.X....X..
.....XX...X
XXX...X....
X...X...X..
X.XX.....XX
X.X.XX.....
.X.X...X...
.X.X......X
X..XX..X..X

output:

First

result:

ok single line: 'First'

Test #35:

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

input:

8 13
....X.X...XX.
....X.....XXX
XX..X.....X..
X.X.......XX.
..X.XX....XX.
XX...XX..XX.X
.XX.X..XX..X.
XXX.....XX..X

output:

First

result:

ok single line: 'First'

Test #36:

score: 0
Accepted
time: 4ms
memory: 4240kb

input:

14 14
XX.X....XXX.XX
X.XX..X.XX.XXX
....XXX.X.X...
X...XXXXX..XXX
X.X.X.X.....X.
..X.....XX.XX.
XX...X.X..X...
XXXXX..X..X.X.
...XXXX.....XX
XX.XX.XXX.XX.X
XX.X.X.XX.....
.XX.X...X....X
X.XXX..X.X.X.X
X.X..XX.XXX.XX

output:

First

result:

ok single line: 'First'

Test #37:

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

input:

12 8
X.X...XX
XXXXXX.X
X.XXXX..
XXX..XX.
..X..X..
X.X...X.
...XXXXX
........
.X.X...X
XXXX...X
X.X...XX
.......X

output:

First

result:

ok single line: 'First'

Test #38:

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

input:

6 14
..XXX.X.XX.XXX
XX.XXXXXX.XXX.
XXXXXXXXXXX.X.
XX.XXXX.XXXXXX
.XXXXXXX.XXXXX
X.X.XXXX.XX.XX

output:

First

result:

ok single line: 'First'

Test #39:

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

input:

9 7
X..XXXX
.XXXXXX
XXXXXXX
XXXX.X.
XXX.X.X
.XXXXX.
.X..XX.
.XXXXXX
XX.XXXX

output:

First

result:

ok single line: 'First'

Test #40:

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

input:

14 6
X.XXXX
XXXXXX
XXXXXX
XXXX.X
X..XX.
XXXXXX
XXXX..
.XXXXX
XXX.XX
XXXXXX
XXXXXX
X.XXXX
XX.XXX
XXXXXX

output:

First

result:

ok single line: 'First'

Test #41:

score: 0
Accepted
time: 26ms
memory: 4224kb

input:

19 18
....X.............
........X.........
..............X...
....X....X........
..................
........X..X......
.X.........X......
...........X......
X.................
..................
.............X.X..
.................X
........X..X......
....X.........X...
.............XX...
............

output:

First

result:

ok single line: 'First'

Test #42:

score: 0
Accepted
time: 16ms
memory: 4452kb

input:

16 18
..................
.....X..XX........
....X.......X....X
.........X.X.X....
.X...........X....
.......XXX....X...
.......X.X......X.
.XX........X.....X
..X.....X.........
.....X...X.....X..
........X.........
............X....X
......XX..........
.....X.....XX.....
...X.......X......
XX......X...

output:

First

result:

ok single line: 'First'

Test #43:

score: 0
Accepted
time: 27ms
memory: 4228kb

input:

18 20
.X....X....X..X..X..
...X........X...X..X
...........X........
X...X.X........XX...
.....X...X...X..X...
.X...X..XX..X.X.....
..................XX
X...XXX......X...X..
...X...X.X..X....X..
..X.......X.......X.
....X..X..X..X...X..
...X..XX............
..X.X.X...X......XX.
.X..XX...X.X..XX...X
...

output:

First

result:

ok single line: 'First'

Test #44:

score: 0
Accepted
time: 16ms
memory: 4236kb

input:

19 16
.....XXX..X....X
......XX....X...
X......X.X..XXX.
......X....X....
.....X..XXX.....
..X...X.....X...
.XX...XX..X.X.X.
..X.X..XX..X...X
.XX...XX..X.....
X.X.XX.X......X.
X..XXX.X..X..X.X
..........X...XX
.........X...XXX
.XX..XX...XXXXX.
.X..X....X.....X
................
XX.X.......X...X
X.......

output:

First

result:

ok single line: 'First'

Test #45:

score: 0
Accepted
time: 16ms
memory: 4192kb

input:

20 16
XX..X.XXX...X..X
X.X..XX.X..X....
.X..X.....X...XX
..X.......X...XX
XX.X.X....XX.X.X
.....X.......XX.
....XX.....XX.X.
X.XXXX..X.XX.X..
..X.XX....X..X.X
X..X.XX.......XX
....X......X.XX.
.XXX..X..XX.XX..
.XX..X.XX.X.X...
..X......X.XX...
...X..X...X.XXX.
.....XX.XXX.XX..
X.XX...XXXXX.X.X
.X.XX...

output:

First

result:

ok single line: 'First'

Test #46:

score: 0
Accepted
time: 6ms
memory: 4252kb

input:

17 16
.XX.X....XX....X
.XX...XX.XX.XXXX
..X...X.XX....X.
.X..X..XX.X.XXX.
X..X...XXXXX.XXX
.X..X.XX.X...X.X
XXX..X..XX..X...
XX.XXX.XXXX.XX.X
X..XXX.XXXX.XX..
..X...X.X.......
.X.....X.X.XXXXX
.X....XXXX...X.X
.X..XX.X.X....XX
..XX.XX.X.XX.X.X
...XXX.X.XXXXX..
..XX..X.X...X.X.
XX.XX.X..X..X.X.

output:

First

result:

ok single line: 'First'

Test #47:

score: 0
Accepted
time: 8ms
memory: 4216kb

input:

17 17
X...XXX.XXXX.XXX.
XXX.XX.XX.XXXX.X.
XX....XX.XXXXX..X
X....X...XX..X.X.
XX.X.XXX.XXX..X.X
.X..XXX.XX.XXXXX.
.X..XX.XXXXXXXX..
.XXXXXX...XXX.XX.
XXXXXX....XXX..X.
...X.X.X.X.X..XXX
.XX.XX....XXX.X..
XXX..XXXX.XXX.X.X
XXXX.XX..X.XX...X
XXX.XXX.X.XXXX..X
XX.XXX.XX..XX.XX.
..XX....XXX.XXX.X
.XXXXX...

output:

First

result:

ok single line: 'First'

Test #48:

score: 0
Accepted
time: 3ms
memory: 4244kb

input:

16 17
XXX...XXX...XX.XX
XXXXXXX.XX.XXXX..
XX..XXXXXXX.XX...
XX.XXXX.XXXXXXXX.
..XXX.XXX..X.XX.X
XXX.XX......XX.X.
X.XXX..XXX..X.XX.
.....XXXXX.X.XX..
.XX..X.XX.XXX..XX
X.XX.XXXX.XX.XX.X
XX.X.X.XX.XXXXXXX
X.XX.XX.XXXXX.X.X
XXXX.XX.X.XXX.XXX
.X.XXX..X.XX...X.
.XX.XXX..XXXX.X.X
XXXXX.X.XX.XXX.XX

output:

First

result:

ok single line: 'First'

Test #49:

score: 0
Accepted
time: 2ms
memory: 4416kb

input:

20 16
XX.XXXXXX....XXX
XXXXXXX.XXXXX.X.
XXX.XXXXXXXX..X.
..XXX.X.XX.X.XXX
XXXXXXXXXX.XXXXX
..X..X..XXXX.XXX
.XXX.XXXX...XXXX
X.XXXXXXXXXXXXXX
XX.XXXXXXXXXXXX.
XXXX.X.XXXXXXX.X
XX.XX..XX.XXX...
XXX...XXX.XXX.X.
XXXXXX..XXXXXXXX
XXXX.XXX.XXXXXX.
XXXXXXXXX.XXXXXX
XXX..XXX.XXXXXXX
X.XX..X.XXXX.XX.
X.XXX...

output:

First

result:

ok single line: 'First'

Test #50:

score: 0
Accepted
time: 2ms
memory: 4204kb

input:

19 19
XXXXXXXXXXXX.XXXXXX
XXXXXXXXXXXXXXXXX.X
.XXXXX.XXXXXX.XX.XX
X.XXXXXXXXX.XX.XXX.
XX.XXXXXXX..X.XXXXX
XXX.XXXX.XXXXXXXXXX
X.XXX.XXXX.XXX.XXXX
XXXXXXX.XXX.XX.XXXX
XXX..XX.XXXX.XXXXX.
XX.XXXXXXXXXXXXXX.X
XXXXX.XXXX.XXXXXXXX
XXXXXX.XXXXXXXXX..X
X.XXXXXXX.X.XXXXXX.
XXXXXXXXXXX.XXXXXX.
XXXXXX.XX.XXXX...

output:

First

result:

ok single line: 'First'

Test #51:

score: 0
Accepted
time: 41ms
memory: 4496kb

input:

20 20
.....X..............
....................
..........X....X..X.
....................
....................
....................
....................
..X.................
....................
..X.................
.............X......
....................
....................
..............X.....
...

output:

First

result:

ok single line: 'First'

Test #52:

score: 0
Accepted
time: 40ms
memory: 4304kb

input:

20 20
....X.....X.........
.............X......
...X....X..X........
...........X.X......
X...X.X....X.X......
.......X.........X..
......X......X.....X
...............XX...
X....X......X.....X.
.......X.X.........X
......X...X......X..
......XX..........X.
.........X..........
.X..................
...

output:

First

result:

ok single line: 'First'

Test #53:

score: 0
Accepted
time: 37ms
memory: 4232kb

input:

20 20
.X..X........X......
X.XX.....XX.........
.X........X.........
....XX..X.X.....X..X
...X...XX....X......
...X..X..X....X.....
X.X.....XX..X.......
X..XX...X..X...X....
......XX.X..........
XX......X..X..X.....
X...X...X.X.......X.
....................
...X...XXXX.XXX...XX
..X.X....XX..XX..XX.
...

output:

First

result:

ok single line: 'First'

Test #54:

score: 0
Accepted
time: 30ms
memory: 4400kb

input:

20 20
.X......X..XXXX..X..
...XXX...XXXXXX..X..
X......XX.X.X....X.X
...X..X..X.X..X....X
..X.......X..X....X.
..X.........X...X..X
X.........XXX...XX..
.XXX..X..X....X.....
...X.X........XX..X.
.X.X.....XXX....X.XX
....XX....X...XX.XXX
...............XXXX.
..X.....X..XX..X.X..
.X...XXXXXX.X.......
...

output:

First

result:

ok single line: 'First'

Test #55:

score: 0
Accepted
time: 30ms
memory: 4284kb

input:

20 20
...X..XX.X..X.X...X.
....X........X.X.XX.
..X....XX.....X..X..
.X.X...XX...X.X..X..
.XX..X...X..X..X..X.
.X...X.XXX.XX..X.XX.
X.X.....X.XXX.XXX.X.
X.X.......XX..X.XX..
..X..X.XX...XXXX....
.X.....X....XX.X...X
XX.X.X.XX.X...XX...X
...XX.X.X..X....X...
...X.XX.XXX.X..XX.XX
X......X..X.X...X..X
...

output:

First

result:

ok single line: 'First'

Test #56:

score: 0
Accepted
time: 25ms
memory: 4188kb

input:

20 20
XX.XX....XXX.XXX.XXX
XXXXX.XXXX.X..XXX.X.
X.XXXX.X..XXX....XX.
.XX..X.XX....X.X.X..
XXX.X.XX..XXX.X.....
XX...XXXXX.X.XX..XX.
.X.XX.X.X..X..X...XX
.X......X.X...XX...X
X.XXX...XXX..XXXX.X.
.......XXXX..X.X.X..
...XXXXXXX..XX......
XXX..X.X.X.X....X.X.
X..XX....X...XX.XX.X
..X.X...XXX.XXXX....
...

output:

First

result:

ok single line: 'First'

Test #57:

score: 0
Accepted
time: 18ms
memory: 4192kb

input:

20 20
..XXXX.X.XXX.XXX.XXX
XXXXXXXXXXX...XXXXX.
X.XXXX.X...XXX..X.XX
XXXXXX.XXXXX..X.XX.X
.X.X.X...XXXX.XXXXXX
XX.X..X...XXX..XXXXX
X...X.XXXXXX.X...X.X
..X.XX..XXXXXXX.XX.X
XXX.XXXX...XXXXX.X..
.XX.XXXX..XXX.X..XXX
.XX..X......XXXX.XXX
XXX..X..XX.XXXXX...X
X.XX.XXXX.X.XXX.X.XX
X.X.X..XXXXXX.X..XX.
...

output:

First

result:

ok single line: 'First'

Test #58:

score: 0
Accepted
time: 15ms
memory: 4276kb

input:

20 20
.X.X.XXX....XX.XXXXX
.XX.XX.XXX.X.XXX.XXX
XXX.XX....X.XXXXX.XX
..X.XXXXX..XX..XXXX.
X.XX...XXXX..XX..XXX
X..XXXX.X...XX.XXXXX
....XXX.X.XXX.X.XX..
X.XX.XXXXX.X.XXXXX..
.XXXXX.XXX.XX.XX.X.X
XXXXXXX.XX..XX..XXXX
.X..XXXX..X.XXXXXXX.
XXXXXXX.XX.X..XX...X
.XXX.X..X.X.XX.XX..X
XXXX.XX..X..XX.XXXXX
...

output:

First

result:

ok single line: 'First'

Test #59:

score: 0
Accepted
time: 8ms
memory: 4172kb

input:

20 20
XXXX.XXX.XX.XXX.XX..
XX.X.XX.XXXX.XXXX.XX
XXX.XXXXXXXXXXX.XXXX
X.XX.XXXXXXXXXXX.XXX
XX.XXXXX.XXXXXXXXX..
XXXXXXXXX.XXX.XXXXXX
XXXXXXXXX.XX.X.XXXX.
XXXXXXXXXXXXXXX.XXXX
XXXXXXXXX...XXXXXXX.
X.XXX.XXX...X.XX.XXX
XXXXXXXX.XXXXXX.X..X
XX.XXX.XXXXX.XX..XXX
XXXXXXXX..XXXXXX.XX.
.XXX.XXX.XXX..XX.XX.
...

output:

First

result:

ok single line: 'First'

Test #60:

score: 0
Accepted
time: 4ms
memory: 4440kb

input:

20 20
XXXX.XXXXXX.XXXXXXXX
XXXXXXXXXXXXXXXXXX.X
XXXXXXXX.XXXXX.XX.XX
XXX.XXXXXXXXXXXXXXXX
X.XXXXXX.XXXXXX.X.X.
XXX.XXXXXXXXXXXXXXXX
..XXXX.XXXXXXXXXXXXX
XX.XX.XXXXXX.XXXXXXX
XXXX.XXX.XXXXX.XXX.X
XXXXXX.X.XXXXXXXXXXX
XX.XX....X.XXXXXX.XX
.XXXXX..XXXXXXXX.XXX
.XXXXXXXXXX.XX..XX..
XX.X.XXXXXXXX..XXXXX
...

output:

First

result:

ok single line: 'First'

Test #61:

score: 0
Accepted
time: 2ms
memory: 4228kb

input:

13 9
.........
.........
.........
.........
.........
.........
.........
.........
.........
.........
.........
.........
.........

output:

First

result:

ok single line: 'First'

Test #62:

score: 0
Accepted
time: 2ms
memory: 4412kb

input:

16 6
......
......
......
......
......
......
......
......
......
......
......
......
......
......
......
......

output:

First

result:

ok single line: 'First'

Test #63:

score: 0
Accepted
time: 4ms
memory: 4180kb

input:

15 11
...........
...........
...........
...........
...........
...........
...........
...........
...........
...........
...........
...........
...........
...........
...........

output:

First

result:

ok single line: 'First'

Test #64:

score: 0
Accepted
time: 7ms
memory: 4188kb

input:

15 14
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............

output:

First

result:

ok single line: 'First'

Test #65:

score: 0
Accepted
time: 5ms
memory: 4164kb

input:

15 12
............
............
............
............
............
............
............
............
............
............
............
............
............
............
............

output:

First

result:

ok single line: 'First'

Test #66:

score: 0
Accepted
time: 6ms
memory: 4172kb

input:

16 12
............
............
............
............
............
............
............
............
............
............
............
............
............
............
............
............

output:

First

result:

ok single line: 'First'

Test #67:

score: 0
Accepted
time: 15ms
memory: 4244kb

input:

14 20
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................
....................

output:

First

result:

ok single line: 'First'

Test #68:

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

input:

14 9
.........
.........
.........
.........
.........
.........
.........
.........
.........
.........
.........
.........
.........
.........

output:

First

result:

ok single line: 'First'

Test #69:

score: 0
Accepted
time: 10ms
memory: 4212kb

input:

17 14
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............
..............

output:

First

result:

ok single line: 'First'

Test #70:

score: 0
Accepted
time: 13ms
memory: 4440kb

input:

20 13
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............
.............

output:

First

result:

ok single line: 'First'

Test #71:

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

input:

11 12
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX

output:

Second

result:

ok single line: 'Second'

Test #72:

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

input:

12 18
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXX

output:

Second

result:

ok single line: 'Second'

Test #73:

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

input:

9 20
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXX

output:

Second

result:

ok single line: 'Second'

Test #74:

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

input:

6 12
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX

output:

Second

result:

ok single line: 'Second'

Test #75:

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

input:

12 12
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX
XXXXXXXXXXXX

output:

Second

result:

ok single line: 'Second'

Test #76:

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

input:

15 17
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX
.................
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX
.................
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX
XXXXXXXXXXX.X.XXX

output:

First

result:

ok single line: 'First'

Test #77:

score: 0
Accepted
time: 5ms
memory: 4248kb

input:

18 20
....................
XXXXXXX.X.XXX.XXXXXX
....................
XXXXXXX.X.XXX.XXXXXX
XXXXXXX.X.XXX.XXXXXX
....................
XXXXXXX.X.XXX.XXXXXX
XXXXXXX.X.XXX.XXXXXX
XXXXXXX.X.XXX.XXXXXX
XXXXXXX.X.XXX.XXXXXX
XXXXXXX.X.XXX.XXXXXX
....................
XXXXXXX.X.XXX.XXXXXX
XXXXXXX.X.XXX.XXXXXX
...

output:

First

result:

ok single line: 'First'

Test #78:

score: 0
Accepted
time: 19ms
memory: 4216kb

input:

19 18
..................
..X.X..X.X.XX.XX.X
..................
..X.X..X.X.XX.XX.X
..X.X..X.X.XX.XX.X
..X.X..X.X.XX.XX.X
..X.X..X.X.XX.XX.X
..................
..X.X..X.X.XX.XX.X
..................
..X.X..X.X.XX.XX.X
..................
..X.X..X.X.XX.XX.X
..................
..X.X..X.X.XX.XX.X
..X.X..X....

output:

First

result:

ok single line: 'First'

Test #79:

score: 0
Accepted
time: 10ms
memory: 4232kb

input:

18 17
XX..XX.XXXX.X.XX.
XX..XX.XXXX.X.XX.
XX..XX.XXXX.X.XX.
XX..XX.XXXX.X.XX.
.................
XX..XX.XXXX.X.XX.
XX..XX.XXXX.X.XX.
XX..XX.XXXX.X.XX.
.................
.................
XX..XX.XXXX.X.XX.
.................
XX..XX.XXXX.X.XX.
XX..XX.XXXX.X.XX.
XX..XX.XXXX.X.XX.
.................
XX..XX...

output:

First

result:

ok single line: 'First'

Test #80:

score: 0
Accepted
time: 6ms
memory: 4436kb

input:

17 19
.XXXXXXX.XXXX..XXXX
.XXXXXXX.XXXX..XXXX
.XXXXXXX.XXXX..XXXX
.XXXXXXX.XXXX..XXXX
...................
.XXXXXXX.XXXX..XXXX
.XXXXXXX.XXXX..XXXX
.XXXXXXX.XXXX..XXXX
.XXXXXXX.XXXX..XXXX
.XXXXXXX.XXXX..XXXX
...................
...................
...................
.XXXXXXX.XXXX..XXXX
.XXXXXXX.XXXX....

output:

First

result:

ok single line: 'First'

Test #81:

score: 0
Accepted
time: 12ms
memory: 4132kb

input:

15 18
..................
..................
....XX.X...XX..XXX
....XX.X...XX..XXX
..................
..................
....XX.X...XX..XXX
....XX.X...XX..XXX
..................
....XX.X...XX..XXX
..................
....XX.X...XX..XXX
..................
..................
..................

output:

First

result:

ok single line: 'First'

Test #82:

score: 0
Accepted
time: 16ms
memory: 4168kb

input:

19 18
X.X.XXX...XX.X.XX.
..................
..................
X.X.XXX...XX.X.XX.
X.X.XXX...XX.X.XX.
..................
..................
..................
..................
..................
..................
X.X.XXX...XX.X.XX.
X.X.XXX...XX.X.XX.
..................
X.X.XXX...XX.X.XX.
X.X.XXX.....

output:

First

result:

ok single line: 'First'

Test #83:

score: 0
Accepted
time: 15ms
memory: 4232kb

input:

17 18
..................
..................
..................
XX..XX..X.X...X...
XX..XX..X.X...X...
..................
..................
XX..XX..X.X...X...
XX..XX..X.X...X...
..................
..................
..................
..................
..................
XX..XX..X.X...X...
............

output:

First

result:

ok single line: 'First'

Test #84:

score: 0
Accepted
time: 8ms
memory: 4356kb

input:

16 18
X.XXX.XXX.XXXXX.X.
X.XXX.XXX.XXXXX.X.
X.XXX.XXX.XXXXX.X.
X.XXX.XXX.XXXXX.X.
X.XXX.XXX.XXXXX.X.
..................
..................
X.XXX.XXX.XXXXX.X.
..................
..................
X.XXX.XXX.XXXXX.X.
X.XXX.XXX.XXXXX.X.
..................
..................
X.XXX.XXX.XXXXX.X.
X.XXX.XXX...

output:

First

result:

ok single line: 'First'

Test #85:

score: 0
Accepted
time: 11ms
memory: 4220kb

input:

16 17
.................
X..XX..X.XX.XX.X.
.................
.................
X..XX..X.XX.XX.X.
.................
X..XX..X.XX.XX.X.
X..XX..X.XX.XX.X.
X..XX..X.XX.XX.X.
X..XX..X.XX.XX.X.
.................
.................
.................
X..XX..X.XX.XX.X.
.................
X..XX..X.XX.XX.X.

output:

First

result:

ok single line: 'First'

Test #86:

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

input:

11 11
XXXXXXXXXX.
.XXXXXXXXXX
XXXXXXXXX.X
XXXXXX.XXXX
XXX.XXXXXXX
XXXXXXX.XXX
XXXX.XXXXXX
XXXXX.XXXXX
XX.XXXXXXXX
XXXXXXXX.XX
X.XXXXXXXXX

output:

First

result:

ok single line: 'First'

Test #87:

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

input:

11 11
XXXXXXXX.XX
XXXXXX.XXXX
XXX.XXXXXXX
XX.XXXXXXXX
XXXX.XXXXXX
XXXXXXX.XXX
.XXXXXXXXXX
XXXXXXXXXX.
XXXXX.XXXXX
X.XXXXXXXXX
XXXXXXXXX.X

output:

First

result:

ok single line: 'First'

Test #88:

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

input:

17 17
XXXXXXXXXXXXXX.XX
XXXX.XXXXXXXXXXXX
XXXXXXXXXXXXXXX.X
XX.XXXXXXXXXXXXXX
XXXXXXXXXXXX.XXXX
XXXXXX.XXXXXXXXXX
XXXXXXXXXXXXX.XXX
XXXXXXXXXXX.XXXXX
X.XXXXXXXXXXXXXXX
XXXXXXX.XXXXXXXXX
XXXXXXXXXXXXXXXX.
.XXXXXXXXXXXXXXXX
XXX.XXXXXXXXXXXXX
XXXXX.XXXXXXXXXXX
XXXXXXXX.XXXXXXXX
XXXXXXXXXX.XXXXXX
XXXXXX...

output:

First

result:

ok single line: 'First'

Test #89:

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

input:

19 19
XXXXXXXX.XXXXXXXXXX
XXXXX.XXXXXXXXXXXXX
XXXXXXXXXXXXXXX.XXX
XXXXXXXXXXXXXXXX.XX
XXXXXXXXXX.XXXXXXXX
XXXXXXXXXXXXXXXXXX.
XXXXXXX.XXXXXXXXXXX
XXXX.XXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXX.X
X.XXXXXXXXXXXXXXXXX
XX.XXXXXXXXXXXXXXXX
XXXXXXXXXXXX.XXXXXX
XXXXXXXXX.XXXXXXXXX
XXXXXX.XXXXXXXXXXXX
XXXXXXXXXXXXXX...

output:

First

result:

ok single line: 'First'

Test #90:

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

input:

17 17
XXXXXXX.XXXXXXXXX
XXXXXXXXXX.XXXXXX
XXXXXXXXXXXXXXXX.
XXXXXXXXXXXXXXX.X
XXXXXXXXXXXXXX.XX
XXXXXXXXXXXX.XXXX
XXXXXX.XXXXXXXXXX
XXXXX.XXXXXXXXXXX
XXXX.XXXXXXXXXXXX
XX.XXXXXXXXXXXXXX
XXXXXXXXX.XXXXXXX
XXXXXXXX.XXXXXXXX
XXXXXXXXXXXXX.XXX
X.XXXXXXXXXXXXXXX
XXX.XXXXXXXXXXXXX
.XXXXXXXXXXXXXXXX
XXXXXX...

output:

First

result:

ok single line: 'First'

Test #91:

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

input:

4 4
X.XX
XXX.
XX.X
.XXX

output:

Second

result:

ok single line: 'Second'

Test #92:

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

input:

9 9
X.XXXXXXX
XXXXXX.XX
.XXXXXXXX
XXXXXXX.X
XXXX.XXXX
XXXXXXXX.
XXXXX.XXX
XXX.XXXXX
XX.XXXXXX

output:

First

result:

ok single line: 'First'

Test #93:

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

input:

2 2
X.
.X

output:

Second

result:

ok single line: 'Second'

Test #94:

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

input:

1 1
.

output:

First

result:

ok single line: 'First'

Test #95:

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

input:

11 11
XXXXXXXXX.X
XXXXXXX.XXX
.XXXXXXXXXX
XXXXXXXXXX.
XX.XXXXXXXX
X.XXXXXXXXX
XXXXXX.XXXX
XXXXXXXX.XX
XXXXX.XXXXX
XXX.XXXXXXX
XXXX.XXXXXX

output:

First

result:

ok single line: 'First'

Test #96:

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

input:

18 18
..XXXXXXXXXXXXXXXX
.XXXXXXXXXXXXXXXXX
XXXXXX..XXXXXXXXXX
XXXXXX.XXXXXXXXXXX
XXXXXXXXXXXX..XXXX
XXXXXXXXXXXX.XXXXX
XXXXXXXXXXXXXX..XX
XXXXXXXXXXXXXX.XXX
XXXXXXXXXXXXXXXX..
XXXXXXXXXXXXXXXX.X
XXXXXXXXXX..XXXXXX
XXXXXXXXXX.XXXXXXX
XX..XXXXXXXXXXXXXX
XX.XXXXXXXXXXXXXXX
XXXXXXXX..XXXXXXXX
XXXXXXXX....

output:

First

result:

ok single line: 'First'

Test #97:

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

input:

6 6
XXXX..
XXXX.X
..XXXX
.XXXXX
XX..XX
XX.XXX

output:

First

result:

ok single line: 'First'

Test #98:

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

input:

18 18
..XXXXXXXXXXXXXXXX
.XXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXX..XX
XXXXXXXXXXXXXX.XXX
XX..XXXXXXXXXXXXXX
XX.XXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXX..
XXXXXXXXXXXXXXXX.X
XXXX..XXXXXXXXXXXX
XXXX.XXXXXXXXXXXXX
XXXXXXXXXX..XXXXXX
XXXXXXXXXX.XXXXXXX
XXXXXX..XXXXXXXXXX
XXXXXX.XXXXXXXXXXX
XXXXXXXX..XXXXXXXX
XXXXXXXX....

output:

First

result:

ok single line: 'First'

Test #99:

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

input:

18 18
..XXXXXXXXXXXXXXXX
.XXXXXXXXXXXXXXXXX
XXXXXXXXXXXX..XXXX
XXXXXXXXXXXX.XXXXX
XX..XXXXXXXXXXXXXX
XX.XXXXXXXXXXXXXXX
XXXXXX..XXXXXXXXXX
XXXXXX.XXXXXXXXXXX
XXXX..XXXXXXXXXXXX
XXXX.XXXXXXXXXXXXX
XXXXXXXXXX..XXXXXX
XXXXXXXXXX.XXXXXXX
XXXXXXXX..XXXXXXXX
XXXXXXXX.XXXXXXXXX
XXXXXXXXXXXXXXXX..
XXXXXXXXX...

output:

First

result:

ok single line: 'First'

Test #100:

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

input:

19 19
XX..XXXXXXXXXXXXXXX
XX.XXXXXXXXXXXXXXXX
XXXXXXXXXXXX..XXXXX
XXXXXXXXXXXX.XXXXXX
XXXXXXXXXX..XXXXXXX
XXXXXXXXXX.XXXXXXXX
XXXXXXXX..XXXXXXXXX
XXXXXXXX.XXXXXXXXXX
XXXXXX..XXXXXXXXXXX
XXXXXX.XXXXXXXXXXXX
XXXXXXXXXXXXXX..XXX
XXXXXXXXXXXXXX.XXXX
..XXXXXXXXXXXXXXXXX
.XXXXXXXXXXXXXXXXXX
XXXX..XXXXXXXX...

output:

First

result:

ok single line: 'First'

Test #101:

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

input:

6 6
XX..XX
XX.XXX
..XXXX
.XXXXX
XXXX..
XXXX.X

output:

First

result:

ok single line: 'First'

Test #102:

score: 0
Accepted
time: 2ms
memory: 4168kb

input:

18 18
XXXXXX..XXXXXXXXXX
XXXXXX.XXXXXXXXXXX
XXXX..XXXXXXXXXXXX
XXXX.XXXXXXXXXXXXX
XX..XXXXXXXXXXXXXX
XX.XXXXXXXXXXXXXXX
XXXXXXXXXX..XXXXXX
XXXXXXXXXX.XXXXXXX
XXXXXXXXXXXXXXXX..
XXXXXXXXXXXXXXXX.X
XXXXXXXX..XXXXXXXX
XXXXXXXX.XXXXXXXXX
XXXXXXXXXXXX..XXXX
XXXXXXXXXXXX.XXXXX
..XXXXXXXXXXXXXXXX
.XXXXXXXX...

output:

First

result:

ok single line: 'First'

Test #103:

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

input:

16 16
XXXXXX..XXXXXXXX
XXXXXX.XXXXXXXXX
..XXXXXXXXXXXXXX
.XXXXXXXXXXXXXXX
XX..XXXXXXXXXXXX
XX.XXXXXXXXXXXXX
XXXX..XXXXXXXXXX
XXXX.XXXXXXXXXXX
XXXXXXXXXXXX..XX
XXXXXXXXXXXX.XXX
XXXXXXXX..XXXXXX
XXXXXXXX.XXXXXXX
XXXXXXXXXX..XXXX
XXXXXXXXXX.XXXXX
XXXXXXXXXXXXXX..
XXXXXXXXXXXXXX.X

output:

Second

result:

ok single line: 'Second'

Test #104:

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

input:

16 16
XXXXXXXXXXXXXX..
XXXXXXXXXXXXXX.X
..XXXXXXXXXXXXXX
.XXXXXXXXXXXXXXX
XX..XXXXXXXXXXXX
XX.XXXXXXXXXXXXX
XXXXXXXX..XXXXXX
XXXXXXXX.XXXXXXX
XXXX..XXXXXXXXXX
XXXX.XXXXXXXXXXX
XXXXXX..XXXXXXXX
XXXXXX.XXXXXXXXX
XXXXXXXXXXXX..XX
XXXXXXXXXXXX.XXX
XXXXXXXXXX..XXXX
XXXXXXXXXX.XXXXX

output:

Second

result:

ok single line: 'Second'

Test #105:

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

input:

19 19
XXXXXXXXXXXXXXXX..X
XXXXXXXXXXXXXXXX.XX
XXXXXX..XXXXXXXXXXX
XXXXXX.XXXXXXXXXXXX
XX..XXXXXXXXXXXXXXX
XX.XXXXXXXXXXXXXXXX
..XXXXXXXXXXXXXXXXX
.XXXXXXXXXXXXXXXXXX
XXXX..XXXXXXXXXXXXX
XXXX.XXXXXXXXXXXXXX
XXXXXXXXXXXX..XXXXX
XXXXXXXXXXXX.XXXXXX
XXXXXXXXXXXXXX..XXX
XXXXXXXXXXXXXX.XXXX
XXXXXXXX..XXXX...

output:

First

result:

ok single line: 'First'

Test #106:

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

input:

9 9
X...X...X
.X..X..X.
..X.X.X..
...XXX...
XXXXXXXXX
...XXX...
..X.X.X..
.X..X..X.
X...X...X

output:

Second

result:

ok single line: 'Second'

Test #107:

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

input:

2 2
..
..

output:

Second

result:

ok single line: 'Second'

Test #108:

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

input:

2 2
X.
..

output:

First

result:

ok single line: 'First'

Test #109:

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

input:

4 5
X....
...X.
.....
.....

output:

First

result:

ok single line: 'First'

Extra Test:

score: 0
Extra Test Passed