QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#102038#4365. Clock Breakingfzj2007AC ✓34ms3540kbC++144.1kb2023-05-02 10:34:492023-05-02 10:34:51

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-05-02 10:34:51]
  • 评测
  • 测评结果:AC
  • 用时:34ms
  • 内存:3540kb
  • [2023-05-02 10:34:49]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
namespace IO{
	template<typename T>inline bool read(T &x){
		x=0;
		char ch=getchar();
		bool flag=0,ret=0;
		while(ch<'0'||ch>'9') flag=flag||(ch=='-'),ch=getchar();
		while(ch>='0'&&ch<='9') x=x*10+ch-'0',ch=getchar(),ret=1;
		x=flag?-x:x;
        return ret;
	}
	template<typename T,typename ...Args>inline bool read(T& a,Args& ...args){
	    return read(a)&&read(args...);
	}
	template<typename T>void prt(T x){
		if(x>9) prt(x/10);
		putchar(x%10+'0');
	}
	template<typename T>inline void put(T x){
		if(x<0) putchar('-'),x=-x;
		prt(x);
	}
	template<typename T>inline void put(char ch,T x){
		if(x<0) putchar('-'),x=-x;
		prt(x);
		putchar(ch);
	}
	template<typename T,typename ...Args>inline void put(T a,Args ...args){
	    put(a);
		put(args...);
	}
	template<typename T,typename ...Args>inline void put(const char ch,T a,Args ...args){
	    put(ch,a);
		put(ch,args...);
	}
	inline void put(string s){
		for(int i=0,sz=s.length();i<sz;i++) putchar(s[i]);
	}
	inline void put(const char* s){
		for(int i=0,sz=strlen(s);i<sz;i++) putchar(s[i]);
	}
	inline int getch(){
		char ch=getchar();
		while(ch!='X'&&ch!='.') ch=getchar();
		return ch=='X';
	}
}
using namespace IO;
const int num[10][7][4]=
{
	{
	{0,1,1,0},
	{1,0,0,1},
	{1,0,0,1},
	{0,0,0,0},
	{1,0,0,1},
	{1,0,0,1},
	{0,1,1,0},
	},
	{
	{0,0,0,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,0,0,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,0,0,0},
	},
	{
	{0,1,1,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,1,1,0},
	{1,0,0,0},
	{1,0,0,0},
	{0,1,1,0},
	},
	{
	{0,1,1,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,1,1,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,1,1,0},
	},
	{
	{0,0,0,0},
	{1,0,0,1},
	{1,0,0,1},
	{0,1,1,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,0,0,0},
	},
	{
	{0,1,1,0},
	{1,0,0,0},
	{1,0,0,0},
	{0,1,1,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,1,1,0},
	},
	{
	{0,1,1,0},
	{1,0,0,0},
	{1,0,0,0},
	{0,1,1,0},
	{1,0,0,1},
	{1,0,0,1},
	{0,1,1,0},
	},
	{
	{0,1,1,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,0,0,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,0,0,0},
	},
	{
	{0,1,1,0},
	{1,0,0,1},
	{1,0,0,1},
	{0,1,1,0},
	{1,0,0,1},
	{1,0,0,1},
	{0,1,1,0},
	},
	{
	{0,1,1,0},
	{1,0,0,1},
	{1,0,0,1},
	{0,1,1,0},
	{0,0,0,1},
	{0,0,0,1},
	{0,1,1,0},
	},
};
const int st[7][21]=
{
	{0,1,1,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,1,1,0},
	{1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1},
	{1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1},
	{0,1,1,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,1,1,0},
	{1,0,0,1,0,1,0,0,1,0,1,0,1,0,0,1,0,1,0,0,1},
	{1,0,0,1,0,1,0,0,1,0,0,0,1,0,0,1,0,1,0,0,1},
	{0,1,1,0,0,0,1,1,0,0,0,0,0,1,1,0,0,0,1,1,0},	
};
int n,mp[105][7][21],ans[7][21],now[7][21],vis0[7][21],vis1[7][21],to[7][21];
inline void prework(int y,int op){
	for(int i=0;i<7;i++)
		for(int j=0;j<4;j++)
			to[i][j+y]=num[op][i][j];
}
inline void solve(int x,int y){
	for(int i=0;i<7;i++)
		for(int j=0;j<21;j++) now[i][j]=1;
	for(int k=1;k<=n;k++){
		memset(to,0,sizeof(to));
		if(x>9) prework(0,x/10);
		prework(5,x%10);
		prework(12,y/10);
		prework(17,y%10);
		to[2][10]=to[4][10]=1;
		for(int i=0;i<7;i++)
			for(int j=0;j<21;j++){
				if(!st[i][j]) continue;
				now[i][j]&=mp[k][i][j]==to[i][j];
				if(!now[i][j]&&!vis0[i][j]&&!vis1[i][j]) return;
			}
		if(++y==60){
			y=0;
			if(++x==24) x=0;
		}
	}
	for(int i=0;i<7;i++)
		for(int j=0;j<21;j++)
			if(!st[i][j]) ans[i][j]=0;
			else if(ans[i][j]==-1) ans[i][j]=now[i][j];
			else ans[i][j]|=now[i][j];
}
int main(){
	read(n);
	for(int i=0;i<7;i++)
		for(int j=0;j<21;j++) vis0[i][j]=vis1[i][j]=1;
	for(int k=1;k<=n;k++)
		for(int i=0;i<7;i++)
			for(int j=0;j<21;j++) mp[k][i][j]=getch(),vis0[i][j]&=!mp[k][i][j],vis1[i][j]&=mp[k][i][j];
	memset(ans,-1,sizeof(ans));
	for(int x=0;x<24;x++)
		for(int y=0;y<60;y++) solve(x,y);
	if(ans[0][0]==-1) return puts("impossible"),0;
	for(int i=0;i<7;i++){
		for(int j=0;j<21;j++){
			if(!st[i][j]) putchar('.');
			else{
				int num=vis0[i][j]+vis1[i][j]+ans[i][j];
				if(num>=2) putchar('?');
				else if(ans[i][j]) putchar('W');
				else if(vis0[i][j]) putchar('0');
				else putchar('1');
			}
		}
		putchar('\n');
	}
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 3360kb

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: 2ms
memory: 3512kb

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: 2ms
memory: 3296kb

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: 2ms
memory: 3348kb

input:

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

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

output:

impossible

result:

ok single line: 'impossible'

Test #5:

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

input:

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

output:

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

result:

ok 7 lines

Test #6:

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

input:

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

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

output:

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

result:

ok 7 lines

Test #7:

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

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: 7ms
memory: 3324kb

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: 11ms
memory: 3336kb

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: 20ms
memory: 3344kb

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: 2ms
memory: 3288kb

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: 0ms
memory: 3360kb

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: 2ms
memory: 3308kb

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: 5ms
memory: 3420kb

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: 22ms
memory: 3540kb

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: 34ms
memory: 3364kb

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: 2ms
memory: 3312kb

input:

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

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

output:

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

result:

ok 7 lines

Test #18:

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

input:

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

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

output:

impossible

result:

ok single line: 'impossible'

Test #19:

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

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: 2ms
memory: 3304kb

input:

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

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

output:

impossible

result:

ok single line: 'impossible'

Test #21:

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

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: 3504kb

input:

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

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

output:

impossible

result:

ok single line: 'impossible'

Test #23:

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

input:

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

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

output:

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

result:

ok 7 lines

Test #24:

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

input:

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

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

output:

impossible

result:

ok single line: 'impossible'

Test #25:

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

input:

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

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

output:

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

result:

ok 7 lines

Test #26:

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

input:

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

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

output:

impossible

result:

ok single line: 'impossible'

Test #27:

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

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: 2ms
memory: 3228kb

input:

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

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

output:

impossible

result:

ok single line: 'impossible'

Test #29:

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

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: 2ms
memory: 3368kb

input:

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

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

output:

impossible

result:

ok single line: 'impossible'

Test #31:

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

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: 0ms
memory: 3220kb

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: 2ms
memory: 3404kb

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: 2ms
memory: 3320kb

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: 3316kb

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: 3336kb

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: 2ms
memory: 3324kb

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