QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#373015#4365. Clock BreakingInfinityNS#AC ✓40ms4024kbC++143.4kb2024-03-31 23:06:512024-03-31 23:06:51

Judging History

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

  • [2024-03-31 23:06:51]
  • 评测
  • 测评结果:AC
  • 用时:40ms
  • 内存:4024kb
  • [2024-03-31 23:06:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

const int N=105;
char s[N][7][22];
char t[7][22];
bool used[7][22];
void ClearT(){
	for(int i=0;i<7;i++){
		for(int j=0;j<21;j++){
			t[i][j]='.';
		}
	}
}
vector<pair<int,int>> dots={{2,10},{4,10}};
void WriteDot(){
	for(int i=0;i<dots.size();i++){
		t[dots[i].first][dots[i].second]='X';
	}
}
vector<pair<int,int>> start={{0,0},{0,5},{0,12},{0,17}};
vector<vector<pair<int,int>>> lines={
	{{0,1},{0,2}},
	{{3,1},{3,2}},
	{{6,1},{6,2}},
	{{1,0},{2,0}},
	{{4,0},{5,0}},
	{{1,3},{2,3}},
	{{4,3},{5,3}}
};
vector<vector<int>> digits={
	{0,2,3,4,5,6},
	{5,6},
	{0,1,2,4,5},
	{0,1,2,5,6},
	{1,3,5,6},
	{0,1,2,3,6},
	{0,1,2,3,4,6},
	{0,5,6},
	{0,1,2,3,4,5,6},
	{0,1,2,3,5,6}
};
void Write(int pos,int num){
	int sx=start[pos].first;
	int sy=start[pos].second;
	for(int lid:digits[num]){
		for(auto p:lines[lid]){
			t[sx+p.first][sy+p.second]='X';
		}
	}
}
void Build(int h,int m){
	ClearT();
	if(h>=10)Write(0,h/10);
	Write(1,h%10);
	WriteDot();
	Write(2,m/10);
	Write(3,m%10);
}
char ans[7][22];
void BuildUsed(){
	for(auto st:start){
		for(int i=0;i<lines.size();i++){
			for(auto p:lines[i]){
				used[st.first+p.first][st.second+p.second]=true;
			}
		}
	}
	for(auto p:dots){
		used[p.first][p.second]=true;
	}
}
bool wasX[7][22];
bool wasDot[7][22];
bool notSure[7][22];
bool ok[7][22];
int main(){
	/*for(int h=0;h<24;h++){
		for(int m=0;m<60;m++){
			Build(h,m);
			printf("%i:%i\n",h,m);
			for(int i=0;i<7;i++)printf("%s\n",t[i]);
			printf("\n");
		}
	}*/
	BuildUsed();
	int n;
	scanf("%i",&n);
	for(int i=1;i<=n;i++){
		for(int j=0;j<7;j++){
			scanf("%s",s[i][j]);
			for(int k=0;k<21;k++){
				if(s[i][j][k]=='X')wasX[j][k]=true;
				else wasDot[j][k]=true;
			}
		}
	}
	/*for(int j=0;j<7;j++){
		for(int k=0;k<21;k++){
			ans[j][k]='.';
		}
	}*/
	for(int j=0;j<7;j++){
		for(int k=0;k<21;k++){
			if(wasX[j][k] && wasDot[j][k]){
				ans[j][k]='W';
			}
		}
	}
	int cnt=0;
	for(int h=0;h<24;h++){
		for(int m=0;m<60;m++){
			bool matches=true;
			int H=h,M=m;
			for(int i=1;i<=n;i++){
				Build(H,M);
				for(int j=0;j<7;j++){
					for(int k=0;k<21;k++){
						if(ans[j][k]=='W' && s[i][j][k]!=t[j][k]){
							matches=false;
							break;
						}
					}
					if(!matches)break;
				}
				if(!matches)break;
				M++;
				if(M==60){
					H=(H+1)%24;
					M=0;
				}
			}
			if(!matches)continue;
			cnt++;
			for(int j=0;j<7;j++){
				for(int k=0;k<21;k++){
					ok[j][k]=true;
				}
			}
			H=h,M=m;
			for(int i=1;i<=n;i++){
				Build(H,M);
				for(int j=0;j<7;j++){
					for(int k=0;k<21;k++){
						if(ans[j][k]!='W' && used[j][k] && s[i][j][k]!=t[j][k]){
							ok[j][k]=false;
						}
					}
				}
				M++;
				if(M==60){
					H=(H+1)%24;
					M=0;
				}
			}
			for(int j=0;j<7;j++){
				for(int k=0;k<21;k++){
					if(ans[j][k]!='W' && used[j][k] && ok[j][k]){
						notSure[j][k]=true;
					}
				}
			}
		}
	}
	if(cnt==0){
		printf("impossible\n");
		return 0;
	}
	for(int j=0;j<7;j++){
		for(int k=0;k<21;k++){
			if(!used[j][k]){
				ans[j][k]='.';
			}else if(ans[j][k]!='W'){
				if(!notSure[j][k]){
					if(wasX[j][k])ans[j][k]='1';
					else ans[j][k]='0';
				}else{
					ans[j][k]='?';
				}
			}
		}
	}
	for(int j=0;j<7;j++){
		printf("%s\n",ans[j]);
	}
	/*for(int j=0;j<7;j++){
		for(int k=0;k<21;k++)printf("%i",used[j][k]);
		printf("\n");
	}*/
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

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

......XX.....XX...XX.
.....X..X...X..X....X
.....X..X.X.X..X....X
.............XX...XX.
.....X..X......X.X..X
.....X..X......X.X..X
......XX......

output:

.??...WW.....??...??.
?..?.W..?...?..1.0..?
?..?.W..?.?.?..1.0..?
.??...??.....11...WW.
?..?.W..?.0.W..?.1..?
?..?.W..?...W..?.1..?
.??...11.....??...??.

result:

ok 7 lines

Test #2:

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

input:

2
......XX.....XX...XX.
...X....X...X..X.X..X
...X....X.X.X..X.X..X
......XX..........XX.
...X.X....X.X..X.X..X
...X.X......X..X.X..X
......XX.....XX...XX.

......XX.....XX......
...X....X...X..X.....
...X....X.X.X..X.....
......XX.............
...X.X....X.X..X.....
...X.X......X..X.....
......XX......

output:

impossible

result:

ok single line: 'impossible'

Test #3:

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

input:

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

.XX...XX.....XX...XX.
...X.X..X...X..X....X
...X.X..X.X.X..X....X
.XX..........XX...XX.
X....X..X......X.X..X
X....X..X......X.X..X
.XX...XX......

output:

.??...WW.....??...??.
?..?.W..?...?..1.0..?
?..?.W..?.?.?..1.0..?
.??...??.....11...WW.
?..?.W..?.0.W..?.1..?
?..?.W..?...W..?.1..?
.??...11.....??...??.

result:

ok 7 lines

Test #4:

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

input:

2
.....................
.....................
..........X..........
.....................
.....................
.....................
.....................

.....................
.....................
.....................
.....................
.....................
.....................
..............

output:

impossible

result:

ok single line: 'impossible'

Test #5:

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

input:

1
.....................
.....................
..........X..........
.....................
..........X..........
.....................
.....................

output:

.??...??.....??...??.
?..?.?..?...?..?.?..?
?..?.?..?.?.?..?.?..?
.??...??.....??...??.
?..?.?..?.?.?..?.?..?
?..?.?..?...?..?.?..?
.??...??.....??...??.

result:

ok 7 lines

Test #6:

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

input:

3
.....................
.....................
..........X..........
.....................
..........X..........
.....................
.....................

.....................
.....................
..........X..........
.....................
..........X..........
.....................
..............

output:

.??...??.....??...00.
?..?.?..?...?..?.?..0
?..?.?..?.?.?..?.?..0
.??...??.....??...00.
?..?.?..?.?.?..?.?..0
?..?.?..?...?..?.?..0
.??...??.....??...00.

result:

ok 7 lines

Test #7:

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

input:

10
.....................
.....................
..........X..........
.....................
..........X..........
.....................
.....................

.....................
.....................
..........X..........
.....................
..........X..........
.....................
.............

output:

.??...??.....??...00.
?..?.?..?...?..?.0..0
?..?.?..?.?.?..?.0..0
.??...??.....??...00.
?..?.?..?.?.?..?.0..0
?..?.?..?...?..?.0..0
.??...??.....??...00.

result:

ok 7 lines

Test #8:

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

input:

25
.....................
.....................
..........X..........
.....................
..........X..........
.....................
.....................

.....................
.....................
..........X..........
.....................
..........X..........
.....................
.............

output:

.??...??.....00...00.
?..?.?..?...?..0.0..0
?..?.?..?.?.?..0.0..0
.??...??.....00...00.
?..?.?..?.?.?..0.0..0
?..?.?..?...?..0.0..0
.??...??.....00...00.

result:

ok 7 lines

Test #9:

score: 0
Accepted
time: 20ms
memory: 3760kb

input:

50
.....................
.....................
..........X..........
.....................
..........X..........
.....................
.....................

.....................
.....................
..........X..........
.....................
..........X..........
.....................
.............

output:

.??...??.....00...00.
?..?.?..?...0..0.0..0
?..?.?..?.?.0..0.0..0
.??...??.....00...00.
?..?.?..?.?.0..0.0..0
?..?.?..?...0..0.0..0
.??...??.....00...00.

result:

ok 7 lines

Test #10:

score: 0
Accepted
time: 39ms
memory: 3780kb

input:

100
.....................
.....................
..........X..........
.....................
..........X..........
.....................
.....................

.....................
.....................
..........X..........
.....................
..........X..........
.....................
............

output:

.??...00.....00...00.
?..?.?..?...0..0.0..0
?..?.?..?.?.0..0.0..0
.??...??.....00...00.
?..?.?..0.?.0..0.0..0
?..?.?..0...0..0.0..0
.??...00.....00...00.

result:

ok 7 lines

Test #11:

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

input:

1
.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX.....XX...XX.

output:

.??...??.....??...??.
1..?.?..?...?..?.?..?
1..?.?..?.?.?..?.?..?
.??...??.....??...??.
?..?.?..?.?.?..?.?..?
?..?.?..?...?..?.?..?
.??...??.....??...??.

result:

ok 7 lines

Test #12:

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

input:

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

.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX......

output:

.??...??.....??...??.
1..?.?..?...?..?.?..?
1..?.?..?.?.?..?.?..?
.??...??.....??...??.
?..?.?..?.?.?..?.1..?
?..?.?..?...?..?.1..?
.??...??.....??...??.

result:

ok 7 lines

Test #13:

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

input:

10
.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX.....XX...XX.

.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX.....

output:

.??...??.....??...11.
1..?.?..?...?..?.1..1
1..?.?..?.?.?..?.1..1
.??...??.....??...11.
?..?.?..?.?.?..?.1..1
?..?.?..?...?..?.1..1
.??...??.....??...11.

result:

ok 7 lines

Test #14:

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

input:

25
.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX.....XX...XX.

.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX.....

output:

.??...??.....11...11.
1..?.?..?...?..?.1..1
1..?.?..?.?.?..?.1..1
.??...??.....??...11.
?..?.?..?.?.1..?.1..1
?..?.?..?...1..?.1..1
.??...??.....11...11.

result:

ok 7 lines

Test #15:

score: 0
Accepted
time: 20ms
memory: 3716kb

input:

50
.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX.....XX...XX.

.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX.....

output:

.??...??.....11...11.
1..?.?..?...1..?.1..1
1..?.?..?.?.1..?.1..1
.??...??.....11...11.
?..?.?..?.?.1..?.1..1
?..?.?..?...1..?.1..1
.??...??.....11...11.

result:

ok 7 lines

Test #16:

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

input:

100
.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX.....XX...XX.

.XX...XX.....XX...XX.
X..X.X..X...X..X.X..X
X..X.X..X.X.X..X.X..X
.XX...XX.....XX...XX.
X..X.X..X.X.X..X.X..X
X..X.X..X...X..X.X..X
.XX...XX....

output:

.??...??.....11...11.
1..?.?..?...1..1.1..1
1..?.?..?.?.1..1.1..1
.??...??.....11...11.
?..?.1..?.?.1..1.1..1
?..?.1..?...1..1.1..1
.??...??.....11...11.

result:

ok 7 lines

Test #17:

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

input:

2
.....................
.....................
.....................
.....................
.....................
.....................
.....................

..................XX.
.....................
.....................
.....................
.....................
.....................
..............

output:

.??...??.....??...WW.
?..?.?..?...?..?.?..0
?..?.?..?.0.?..?.?..0
.??...??.....??...00.
?..?.?..?.0.?..?.?..0
?..?.?..?...?..?.?..0
.??...??.....??...00.

result:

ok 7 lines

Test #18:

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

input:

3
.....................
.....................
.....................
.....................
.....................
.....................
.....................

..................XX.
.....................
.....................
.....................
.....................
.....................
..............

output:

impossible

result:

ok single line: 'impossible'

Test #19:

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

input:

2
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
....................X
....................X
.....................
.....................
.....................
..............

output:

.??...??.....??...00.
?..?.?..?...?..?.0..W
?..?.?..?.0.?..?.0..W
.??...??.....??...00.
?..?.?..?.0.?..?.0..0
?..?.?..?...?..?.0..0
.??...??.....??...00.

result:

ok 7 lines

Test #20:

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

input:

3
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
....................X
....................X
.....................
.....................
.....................
..............

output:

impossible

result:

ok single line: 'impossible'

Test #21:

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

input:

2
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.....................
.....................
.....................
....................X
....................X
..............

output:

.??...??.....??...00.
?..?.?..?...?..?.?..0
?..?.?..?.0.?..?.?..0
.??...??.....??...00.
?..?.?..?.0.?..?.0..W
?..?.?..?...?..?.0..W
.??...??.....??...00.

result:

ok 7 lines

Test #22:

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

input:

3
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.....................
.....................
.....................
....................X
....................X
..............

output:

impossible

result:

ok single line: 'impossible'

Test #23:

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

input:

2
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.....................
.....................
.....................
.....................
.....................
..............

output:

.??...??.....??...00.
?..?.?..?...?..?.?..0
?..?.?..?.0.?..?.?..0
.??...??.....??...00.
?..?.?..?.0.?..?.?..0
?..?.?..?...?..?.?..0
.??...??.....??...WW.

result:

ok 7 lines

Test #24:

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

input:

3
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.....................
.....................
.....................
.....................
.....................
..............

output:

impossible

result:

ok single line: 'impossible'

Test #25:

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

input:

2
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.....................
.....................
.....................
.................X...
.................X...
..............

output:

.??...??.....??...00.
?..?.?..?...?..?.?..?
?..?.?..?.0.?..?.?..?
.??...??.....??...00.
?..?.?..?.0.?..?.W..0
?..?.?..?...?..?.W..0
.??...??.....??...00.

result:

ok 7 lines

Test #26:

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

input:

3
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.....................
.....................
.....................
.................X...
.................X...
..............

output:

impossible

result:

ok single line: 'impossible'

Test #27:

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

input:

2
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.................X...
.................X...
.....................
.....................
.....................
..............

output:

.??...??.....??...00.
?..?.?..?...?..?.W..0
?..?.?..?.0.?..?.W..0
.??...??.....??...00.
?..?.?..?.0.?..?.?..0
?..?.?..?...?..?.?..0
.??...??.....??...00.

result:

ok 7 lines

Test #28:

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

input:

3
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.................X...
.................X...
.....................
.....................
.....................
..............

output:

impossible

result:

ok single line: 'impossible'

Test #29:

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

input:

2
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.....................
.....................
..................XX.
.....................
.....................
..............

output:

.??...??.....??...00.
?..?.?..?...?..?.?..0
?..?.?..?.0.?..?.?..0
.??...??.....??...WW.
?..?.?..?.0.?..?.0..0
?..?.?..?...?..?.0..0
.??...??.....??...00.

result:

ok 7 lines

Test #30:

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

input:

3
.....................
.....................
.....................
.....................
.....................
.....................
.....................

.....................
.....................
.....................
..................XX.
.....................
.....................
..............

output:

impossible

result:

ok single line: 'impossible'

Test #31:

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

input:

2
.............XX...XX.
............X..X.X..X
............X..X.X..X
.............XX...XX.
............X..X.X..X
............X..X.X..X
.............XX...XX.

.XX..........XX...XX.
............X..X.X..X
............X..X.X..X
.............XX...XX.
............X..X.X..X
............X..X.X..X
..............

output:

.WW...00.....??...??.
?..0.0..0...?..1.?..?
?..0.0..0.0.?..1.?..?
.00...00.....11...11.
0..0.0..0.0.1..?.1..?
0..0.0..0...1..?.1..?
.00...00.....??...??.

result:

ok 7 lines

Test #32:

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

input:

2
.XX..........XX...XX.
............X..X.X..X
............X..X.X..X
.............XX...XX.
............X..X.X..X
............X..X.X..X
.............XX...XX.

.............XX...XX.
............X..X.X..X
............X..X.X..X
.............XX...XX.
............X..X.X..X
............X..X.X..X
..............

output:

.WW...00.....??...??.
?..0.0..0...?..1.?..?
?..0.0..0.0.?..1.?..?
.00...00.....11...11.
0..?.0..0.0.1..?.1..?
0..?.0..0...1..?.1..?
.00...00.....??...??.

result:

ok 7 lines

Test #33:

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

input:

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

.............XX...XX.
............X..X.X..X
............X..X.X..X
.............XX...XX.
............X..X.X..X
............X..X.X..X
..............

output:

impossible

result:

ok single line: 'impossible'

Test #34:

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

input:

42
.............XX...XX.
X..X.X.........X.X..X
X..X.X.........X.X..X
.XX..................
...X.X..X......X.....
...X.X..X......X.....
.XX..........XX......

.............XX......
X..X.X.........X.X..X
X..X.X.........X.X..X
.XX..................
...X.X..X......X.....
...X.X..X......X.....
.XX..........

output:

.??...??.....11...WW.
1..?.?..?...W..W.1..1
1..?.?..?.0.W..W.1..1
.??...??.....00...00.
?..?.?..?.0.0..1.0..0
?..?.?..?...0..1.0..0
.??...??.....11...00.

result:

ok 7 lines

Test #35:

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

input:

37
.XX...XX.....XX...XX.
X..X....X........X...
X..X....X.X......X...
.XX...............XX.
...X.X....X.X..X....X
...X.X......X..X....X
......XX.....XX......

.XX...XX.....XX...XX.
X..X....X........X...
X..X....X.X......X...
.XX..................
...X.X....X.X..X....X
...X.X......X..X....X
......XX.....

output:

.??...??.....11...11.
1..?.0..?...0..0.1..0
1..?.0..?.?.0..0.1..0
.??...??.....00...WW.
?..?.1..0.?.1..1.0..W
?..?.1..0...1..1.0..W
.??...WW.....WW...00.

result:

ok 7 lines

Test #36:

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

input:

47
......XX.....XX...XX.
........X...X.......X
........X.X.X.......X
.............XX......
.....X..X.X.X..X.....
.....X..X...X..X.....
.............XX...XX.

......XX.....XX...XX.
........X...X..X....X
........X.X.X..X....X
.....................
.....X..X.X.X..X.....
.....X..X...X..X.....
......XX.....

output:

.??...??.....WW...WW.
?..?.?..?...W..W.0..1
?..?.?..?.?.W..W.0..1
.??...00.....WW...00.
?..?.1..?.?.1..W.0..0
?..?.1..?...1..W.0..0
.??...WW.....11...11.

result:

ok 7 lines

Test #37:

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

input:

36
......XX.....XX...XX.
........X......X.X..X
........X......X.X..X
......XX.....XX...XX.
.....X...........X...
.....X...........X...
......XX.....XX...XX.

......XX.....XX...XX.
........X......X.X..X
........X......X.X..X
......XX.....XX...XX.
.....X..............X
.....X..............X
......XX.....

output:

.??...??.....WW...WW.
?..?.?..?...W..W.1..W
?..?.?..?.0.W..W.1..W
.??...??.....??...WW.
?..?.?..?.0.0..W.W..W
?..?.?..?...0..W.W..W
.??...??.....WW...WW.

result:

ok 7 lines