QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#110524#6541. Make Everything WhiteCrysflyAC ✓263ms38668kbC++171.0kb2023-06-02 18:19:302023-06-02 18:21:35

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-06-02 18:21:35]
  • 评测
  • 测评结果:AC
  • 用时:263ms
  • 内存:38668kb
  • [2023-06-02 18:19:30]
  • 提交

answer

#include<bits/stdc++.h>
#define For(i,a,b) for(int i=(a);i<=(b);++i)
#define Rep(i,a,b) for(int i=(a);i>=(b);--i)
using namespace std;
inline int read()
{
	char c=getchar();int x=0;bool f=0;
	for(;!isdigit(c);c=getchar())f^=!(c^45);
	for(;isdigit(c);c=getchar())x=(x<<1)+(x<<3)+(c^48);
	if(f)x=-x;return x;
}

#define fi first
#define se second
#define pb push_back
#define mkp make_pair
typedef pair<int,int>pii;
typedef vector<int>vi;

#define maxn 200005
#define inf 0x3f3f3f3f

int n,m;
char s[2005][2005];
int res[2005][2005],a[2005][2005];
int dx[4]={0,1,0,-1},dy[4]={1,0,-1,0};

void work()
{
	n=read(),m=read();
	For(i,1,n)cin>>(s[i]+1);
	For(i,1,n)For(j,1,m)a[i][j]=(s[i][j]=='B');
	For(i,1,n)
		For(j,1,m){
			res[i][j]=2;
			For(k,0,3){
				int xx=i+dx[k],yy=j+dy[k];
				if(xx>0&&yy>0&&xx<=n&&yy<=m)a[xx][yy]^=1;
			}
		}
	For(i,1,n)
		For(j,1,m)if(a[i][j])res[i][j]^=1;
	puts("1")
;	For(i,1,n){
		For(j,1,m)cout<<res[i][j];
		puts("");
	}
}

signed main()
{
	int T=1;
	while(T--)work();
	return 0;
}

这程序好像有点Bug,我给组数据试试?

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2 3
WBW
BWB

output:

1
222
333

result:

ok ok

Test #2:

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

input:

1 1
B

output:

1
3

result:

ok ok

Test #3:

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

input:

1 3
BWB

output:

1
222

result:

ok ok

Test #4:

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

input:

3 1
B
B
B

output:

1
2
3
2

result:

ok ok

Test #5:

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

input:

1 10
BBWWWWWWBW

output:

1
2322222233

result:

ok ok

Test #6:

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

input:

2 9
WWWWBWWWB
BBWWBWWWW

output:

1
233323333
323323332

result:

ok ok

Test #7:

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

input:

3 8
BBBBBBBB
WBWBBWBB
BBWWWWBW

output:

1
32222223
33233232
32333322

result:

ok ok

Test #8:

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

input:

4 7
BWWWWWB
WWBWWWB
WBBWBWW
BBBBBWW

output:

1
3333333
3232222
3332323
3222232

result:

ok ok

Test #9:

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

input:

5 6
BWWBWB
WWBBBB
BWBWBB
BWBWBW
BBWWWB

output:

1
333233
323332
223232
223233
323333

result:

ok ok

Test #10:

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

input:

6 5
BBBBW
BBBWB
WBBBW
WBWBW
WWWWB
WWBBB

output:

1
32222
23322
33333
33233
32222
23223

result:

ok ok

Test #11:

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

input:

7 4
BWWW
WWBW
BBBW
WWWB
BBWB
BBWB
BBWB

output:

1
3332
3233
2333
3222
2322
2322
3233

result:

ok ok

Test #12:

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

input:

8 3
WWW
BWB
WBW
BBB
BBB
BBW
WBB
WWB

output:

1
232
222
333
232
232
233
332
233

result:

ok ok

Test #13:

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

input:

9 1
B
B
W
B
W
B
W
B
W

output:

1
2
3
2
3
2
3
2
3
3

result:

ok ok

Test #14:

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

input:

1 1000
BWWBWWWBWBBBWBBBWBBWBBBWBBBBBBBWWBBWWWWBWBBWBWBWBWBBWWBWBWBWWWWBWBBBBBWWBWBWBWWWBBBWBBWWBWBBBBBBWWWBWBBBWWWWWWBBWWWWBWBWBBWBWBWBBWBBWBBBWWBWBBBBWBWWBWWWBBWWWBBWBWBWBBWWWBBWBBWWWWWBBWBWBWBBWWWWWBWBBBBWBBWBWWWBBBWWBWWBBBWWWBWBBBBBWBWWWBWWWWWBBWWBWWBBWBWBWBBWBWWWBBBBBBBBWWBWBWWBBBWBWWBBWBWWWBBBB...

output:

1
2223222323332333233233323333333223322223233232323233223232322223233333223232322233323322323333332223233322222233222232323323232332332333223233332322322233222332323233222332332222233232323322222323333233232223332232233322232333332322232222233223223323232332322233333333223232233323223323222333332323...

result:

ok ok

Test #15:

score: 0
Accepted
time: 9ms
memory: 5120kb

input:

100 1000
WWBBWWBWWWBWBWBBBBWBBBWWWBBBBWWBWWWWBWWWWWWBWBBWBWBBWWBBWBWWBWBBWBWBBWBBBBWBBWWBBWBBBBBBBBWWBWWBBBBBBBBBBBBWWBBWWWWWWBBWWBWWWWBBWWWBWWBBWWWWWWWWBWBBWBBBBWWBWBWWBBBBWBWBWWWBBWBWWWBWWBBWWBBBBBBBWBBBWWWBBWBBBBBWWWWBWBWWWWBWWWBWWBBBWBBWBWBBWBBWWBWBWWBWWBWBWBBBWBBWWBWBBBWBWWBWWWWBBBWWWBWBBBWBWBB...

output:

1
2322332333232322223222333222233233332333333232232322332232332322323223222232233223222222223323322222222222233223333332233233332233323322333333332322322223323233222232323332232333233223322222223222333223222223333232333323332332223223232232233232332332323222322332322232332333322233323222323222222322...

result:

ok ok

Test #16:

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

input:

200 999
WWWWWBWBWBWBWWBWWBWWWWWWWBWBWBBBWBWBWWBBBWWBBBWWBBBWBWWWWWBWWWBBWBWBBWBBBBBWWWBWWBWWBWBWWBWWBBWWWBWBWWWWWWWWWBWBWBWWWWWBWWBBWWWWWWBBWBWWBWWBWBWWBBWWWBBWWWWBBWBBBWWWBWBBBBWBWWWBBWWBBBWBWWWWWWWBWBWBBWBBWBBWWWWWWBBWWBWWBWWBBWBWBWBWBWWWWBWBBBWWWWBBBWWWWWWWBWBWBWBBBBBWWWWBWBBWBWWBWBWWBBBBBBWWBBBW...

output:

1
2333323232323323323333333232322232323322233222332223233333233322323223222223332332332323323322333232333333333232323333323322333333223233233232332233322333322322233323222232333223322232333333323232232232233333322332332332232323232333323222333322233333332323232222233332322323323233222222332223322322...

result:

ok ok

Test #17:

score: 0
Accepted
time: 24ms
memory: 8648kb

input:

299 999
BBWBBWWBBBBWWBWWWBBWWBWBWBWWWWBBBBBWBBBWWWWWWBBBBWBBWWWBWBBWWWBWWWWBWWWWWWWBBBWWBWBWWBWBWBWWBBWBWWBWBWBWBWWBBWWBWWWBWBWBBBBWBBBWWWBBBBWWBWWWWBWWWWWWBWBBWBWBBWWBBWBWWBWBBWBWBBWBBBBWBBWWBBWBBBBBBBBWWBWWBBBBBBBBBBBBWWBBWWWWWWBBWWBWWWWBBWWWBWWBBWWWWWWWWBWBBWBBBBWWBWBWWBBBBWBWBWWWBBWBWWWBWWBBWWBB...

output:

1
3232233222233233322332323233332222232223333332222322333232233323333233333332223323233232323322323323232323322332333232322223222333222233233332333333232232322332232332322323223222232233223222222223323322222222222233223333332233233332233323322333333332322322223323233222232323332232333233223322222223...

result:

ok ok

Test #18:

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

input:

300 1000
BWWBWBWWBWBWWWBBWWWWBWWBWBWBBBBBWBBWWWWWBBWWWWBWWWWWWBWBWBWBBBBBWBBBBBWBWWWBBBBBBBWWBBWBWWWWBWBWBBBBWWWWWBWBBBWBWWWWWWWBWWWBBWWBWBBWBBBWBBWBWWWBWBWBBWBBWBWWBWBWWBBWBBWWBBWWWBBBBBWWBBWWBWWWWWWBBWWWWBBBWBBBBBWWBBBBBWBBWBBWBBBBBBWBWBWWBBWBWBWWBBWBBBBBBBWWWWBBWWBBBBWWWWBBBBBBBBBBBBBWWBBWWBWBWBB...

output:

1
3332323323233322333323323232222232233333223333233333323232322222322222323332222222332232333323232222333332322232333333323332233232232223223233323232232232332323322322332233322222332233233333322333322232222233222223223223222222323233223232332232222222333322332222333322222222222223322332323223233232...

result:

ok ok

Test #19:

score: 0
Accepted
time: 23ms
memory: 10580kb

input:

400 999
BBBBBWWBBBWWBWWWWWWWWBBBBWWBWBWBBWWBBBWBBBWBWBWWWWBWWWWWWBWBWWBBWWBWBWWWWWBBWWBWWBWWBWBBBBBWBWBBBBBWBBWBWBWWBBBWWWWWBBWWBWBWWBBBWWWBWBWWBWBWBBWWWBWWWBBWWWWBBBBWBWWBWBBWWBBBWBWBWWWBWBBBWBWBWBBWBBWWBBWWBBWBWBBBBWWWWBBBBBBBWBWBBBBBWBBWWBWBBWBWWWWBWBWBBBWBBWWBBBBWWWBWWBBBWWBWBWBWBWWWWBBBWBWWBBWB...

output:

1
3222233222332333333332222332323223322232223232333323333332323322332323333322332332332322222323222223223232332223333322332323322233323233232322333233322333322223233232233222323233323222323232232233223322323222233332222222323222223223323223233332323222322332222333233222332323232333322232332232223333...

result:

ok ok

Test #20:

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

input:

500 1000
WWWBBBBWBBWWBBBWWBBBWWBWWWWWBBWBBBWBBBWBBWWWBBBBBBBBWBWWBBBWWBBBBBBWWWWBBBWWBBBBWBWWBWWWWWWBBBWBBBBWWBBBWWWBWBBBBBWWBBWWWBBBBBWBBWWBWWBBBBWWWBWBWBWBBBWWWBBWWWWBBWWWWWWWWBBBBWBWWWBWWWBBWWBBWBWWWBBBWWWWBBWWWBBBBBBBBWWWWWBBWWBBBWBWBWWBWBBBBWWWBWWBBBBBBWBWBBBWWBBWWWWWWBBBBBWBWBBBBBWWWBWWBBWWWBB...

output:

1
2332222322332223322233233333223222322232233322222222323322233222222333322233222232332333333222322223322233323222223322333222223223323322223332323232223332233332233333333222232333233322332232333222333322333222222223333322332223232332322223332332222223232223322333333222223232222233323322333223223333...

result:

ok ok

Test #21:

score: 0
Accepted
time: 35ms
memory: 14052kb

input:

600 1000
WBBBBWBBWBBBBWBBBBWBBBBWBWWBBBWWBBWBBWWWWBBWBWWWBBBWBWBBBWWWBWWWBBWWWBWWWBBBWWBWWWWBWWBBWWWWBWBBBWBWWBWBWBBBBBWBWBWWBWWWWBBBWWBWBBBBBWBWBWBWWBBBBBBBBBWWWWWWBWBWBWBBWBWWBBWWBWBBWBBBWBWBBWBWWBBWBBWBBWWBBBWWBBBWWBWBBWWWBWWBBBBWBBWWBBBBBWBWBWBWBBBBBBWWWWWBBBBWBBBWBWWBBWWWBWBWBWBBWBBBBWBBWBBBWBW...

output:

1
2222232232222322223222232332223322322333322323332223232223332333223332333222332333323322333323222323323232222232323323333222332322222323232332222222223333332323232232332233232232223232232332232232233222332223323223332332222322332222232323232222223333322223222323322333232323223222232232223233323332...

result:

ok ok

Test #22:

score: 0
Accepted
time: 49ms
memory: 15636kb

input:

700 1000
BWBWBWWWBBBWBWWBBWBBWBBWWBWWBWBWBBWWBBBWWBBBBBWWBBWBWBBWWWWBBWBBWBBWBBBBBWWWBBBWWWBWWBWBBWWBBWWWBWWBWWWBWBWBWWBBBWBWBBWBWWBBWBWBWWWBWWWWBWBWWWWBWBBBWBWBWWWWBWBBBBWBBBWWWBWBWWBWWBBWBWWWBWBBWBBBBWBBWBBBWWWBBWBBWBBWWBWWBBBBWWWBBBBWWBBBWWBBWBBBWBWBWWBBBWBBBWWWBBWWWBWBWWBWWWWWWWBBWBWWWBBWBWWWBWB...

output:

1
3323233322232332232232233233232322332223322222332232322333322322322322222333222333233232233223332332333232323322232322323322323233323333232333323222323233332322223222333232332332232333232232222322322233322322322332332222333222233222332232223232332223222333223332323323333333223233322323332322332222...

result:

ok ok

Test #23:

score: 0
Accepted
time: 58ms
memory: 17508kb

input:

800 1000
BBWWBWWBWBBBBBBWWWBBBBWWWBWWBBBWBBBWBBWBWWBBBBWBBBWWBWWWWBBBBBWBWWWWBWWBBWBWWWBBWWBBWBBWWWBBWBWWWBWBBWBWBWBWBWWBWWWWBWWBWWBWWWBWWBBBWBBBBBWWBWBBWBBBWBBBBWBWBWWWBBWBBWWWWBBBWWWBWWBBBWWWWWWBWBWWBWBBBBBWWWBBWWBBWBBBBBBBBWWWWWBWBBWBBWBBBBBWWWWBBWBBBWWWWWBWBWBBBWBBWBWBBBWBBWWBBWBBWBBBWWWBWBBWBBW...

output:

1
3233233232222223332222333233222322232232332222322233233332222232333323322323332233223223332232333232232323232332333323323323332332223222223323223222322223232333223223333222333233222333333232332322222333223322322222222333332322322322222333322322233333232322232232322232233223223222333232232232232223...

result:

ok ok

Test #24:

score: 0
Accepted
time: 61ms
memory: 19272kb

input:

900 1000
BBBWBBBBBWBWBWBBBBWWBWBWBBBWBWWWWWBBWBBWWWWBBWWBBBBWWWWWBBWBWBBBBWBWWWBBBWWWWBBBWWBBBWWBWWBWWWWBBBWBBWWWWWWWBBWBBBBWBWBWWWBBBWBWBBWWWWWWBWWBBWBWBBWWWWWWBWWWWBWBBWWBWBBWBWWBWBWWWWWBBWWBWBBWBBBBBBBWBBBBWWBBWBBWBWWWWWBBBBBBWBWWWBBWBWBWWWWWWWBWBWWBBBBBBBWBWBBWBWWBBBWWWBWWBBWWWWWWBBBWBBWBWBBWWBB...

output:

1
3223222223232322223323232223233333223223333223322223333322323222232333222333322233222332332333322232233333332232222323233322232322333333233223232233333323333232233232232332323333322332322322222223222233223223233333222222323332232323333333232332222222323223233222333233223333332223223232233223223322...

result:

ok ok

Test #25:

score: 0
Accepted
time: 139ms
memory: 21044kb

input:

1000 2000
WBBWWWWBBBWWBWBWWBBBBBWBBBBBWWBWWWBBBWBWBBBWWBBBBBWWWWBBBWWWWBBBBBWBBBBBWBBWWBBBBBWWWBBBWWWBBWBWBWWWBBWBBWBWBBBBWWBBWBWWBWBBWBWBBBBWBWWBWBWWWBWBBWWWWWWWWWWWBBWWBBWWBBBBBWBBWWBWBBWBBWBBBWWWBWBWWBWBBWWBBWBWBWWBWWWBBBWBBBWWBWWWBBBWWBBBBBWBBBBWWBBBWBWWBWBBBWWWWBWBBBWWBBBBBBWBWBWBBWBWBBWBBBBBBW...

output:

1
2223333222332323322222322222332333222323222332222233332223333222223222223223322222333222333223232333223223232222332232332322323222232332323332322333333333332233223322222322332322322322233323233232233223232332333222322233233322233222223222233222323323222333323222332222223232322323223222222323323223...

result:

ok ok

Test #26:

score: 0
Accepted
time: 156ms
memory: 24564kb

input:

1200 1999
WWBWWBBWBWBWWBWBWBWBWBBWWWBWBBWWBWWBWWBWBWBWWBBWWBWWBWWWWWBWWWWBWWBWWWWWWWWWWWWWWBWBBBWBWWBBWWWBWWWWBBBBBBBBWBWBBWWBBWWWWBWWBWWBWBBWWBWWBBBWBWBBWBWBBBWBBWBBBBBBWWWWBWBBWWBBWWBBBWBBBBBWBBWWBBWBWBWWBWBWWWWWBWBWWBWWWBBBWWWWBBBWWBWBBWWWWBWWWWWBWBBBBBWBBWBBBBBWBBWWBWWWWBBWWWWBWWWWWBBBBWBBWBWWWW...

output:

1
2323322323233232323232233323223323323323232332233233233333233332332333333333333332322232332233323333222222223232233223333233233232233233222323223232223223222222333323223322332223222223223322323233232333332323323332223333222332322333323333323222223223222223223323333223333233333222232232333322222322...

result:

ok ok

Test #27:

score: 0
Accepted
time: 151ms
memory: 26436kb

input:

1299 1999
BBBWWWWWBWBWWBWBBWWBWWBWWBBBWBBBBBWBBBBWWBWBBBWBWWBWWWWWWBBBBWBBWWBBWBWWBBBBBBBBWBWWBBWBWBBBWWWBWBBBWWBBWBBBBBBBBWBWBWBBWBWBBWWWBWBBBWWBBBWBBBWWBBWWWWBWBBBBWBWWWWWBBBWWBWWBWWWBWBBWBBWBBWWBWBWBWBWWBBWBBBBWWWBWWBBBWBBWWBBWBWBBBBBWWBWBBWBBBBBBBBBWWBWWWWBBWWWWBWWWWBWWBBWWWBBBWBBBBWWBBBWBWBBWBW...

output:

1
3223333323233232233233233222322222322223323222323323333332222322332232332222222232332232322233323222332232222222232323223232233323222332223222332233332322223233333222332332333232232232233232323233223222233323322232233223232222233232232222222223323333223333233332332233322232222332223232232332222333...

result:

ok ok

Test #28:

score: 0
Accepted
time: 171ms
memory: 26300kb

input:

1300 2000
WWBWBWBWWWBBBBWWBWBBWWBWBWWWWWBBBWBWWWWWWBBWBBBBWWWWBWBBWWBBBBWBWBBBBBBWWBWBBWBBBBWBWWBBWWWBWWBBBBWBWWBWWWWBWWWBWBBBBBBWBBBBBBBWWBWBWWBBWWWBBBBWWWWWWBBBBBBWBWWBBWWBWWBBBWWBBWBWWBWBWWWBBWBWBBBWBWWBWBBWBBWBWWWBWWWWBBBWWBBWBWBBWWWBWWWBBBWWWBWBWWWBWBBWWBBWBBWBBWWBWBWBWBWBBWWBBWWBWWWBWWWWBBWBWW...

output:

1
2323232333222233232233232333332223233333322322223333232233222232322222233232232222323322333233222232332333323332322222232222222332323322333222233333322222232332233233222332232332323332232322232332322322323332333322233223232233323332223332323332322332232232233232323232233223323332333322323332333333...

result:

ok ok

Test #29:

score: 0
Accepted
time: 171ms
memory: 28208kb

input:

1400 1999
WWWWBWWBWWBWBWBBBWBBWWBBWBWWWWWWBBBBBBBBWWWBWWBWBBBWBWBWBBWBWWWWBWBWWBWWWBWWWBWWWBWWBBBWBBBBWBBWWWBWWWWWWBBWWWBWBWBBWBWBWWWWWWBWWWBBBWBBBWBBBBWBWWBBWBWBWBBWBBWBBWWBWBBBWBBBBWBBWBWWBBBWWBWBBWWWBWBWWBBWBBWWWBBWBBWWBWWBWWBBWWBBWBWWBWBBWBWWBBBBBWBBWBWWWWBWWBWWBWBBBBWWWBBBBBBBBBBBBWWBBWBBBWBBWB...

output:

1
2333233233232322232233223233333322222222333233232223232322323333232332333233323332332223222232233323333332233323232232323333332333222322232222323322323232232232233232223222232232332223323223332323322322333223223323323322332232332322323322222322323333233233232222333222222222222332232223223223232322...

result:

ok ok

Test #30:

score: 0
Accepted
time: 180ms
memory: 29976kb

input:

1500 2000
WWBWBBWWBWWBWWBBWWWBBWWWBBWBWWBBBWBBWWWWBWWBBWWWWWBWBWBWBWWWWWWBBBBBWWWWBWWWBWBBWWBBBWBWBWBWWBWWWWBWWBWWWBWBBBWBBBWBBWBBBWBBBBBBBWWBBWWWWBWBBWBWBWBWBBWWBWBWBWWWWBWBBBBBWWBWBWBWWWBBBWBBWWBWBBBBBBWWWBWBBBWWWWWWBBWWWWBWBWBBWBWBWBBWBBWBBBWWBWBBBBWBWWBWWWBBWWWBBWBWBWBBWWWBBWBBWWWWWBBWBWBWBBWWWW...

output:

1
2323223323323322333223332232332223223333233223333323232323333332222233332333232233222323232332333323323332322232223223222322222223322333323223232323223323232333323222223323232333222322332322222233323222333333223333232322323232232232223323222232332333223332232323223332232233333223232322333332322223...

result:

ok ok

Test #31:

score: 0
Accepted
time: 212ms
memory: 31556kb

input:

1600 2000
BBBWBBBBWBWWWBWBBBWBWBWWWBWWBBWBBWWBWBBBBBWBBBWBWWBBWBBBBWBWWBBWBBWBWBBWBWBBWBBWWWWWBBWBWWBBWBBBWBBWWBBWWWWBWBBBWWBBWBBBBWBBBBWWBBBBWBBBWWBBWWWWWWBWWWWBBWBWWWWBWBWWBWWBBWWBWBBBWWBWBBWWBWWWBBBBWWBWWBWWWBWWWWWBBBBBBWWWBBWBWWBBWWWWBWBWBBBBBBWBWWBBBBWBBWBWWWWBWBWWWWBWBBBWBWWBBBWWWBWBWBWBWBBBWW...

output:

1
3223222232333232223232333233223223323222223222323322322223233223223232232322322333332232332232223223322333323222332232222322223322223222332233333323333223233332323323322332322233232233233322223323323332333332222223332232332233332323222222323322223223233332323333232223233222333232323232223323233223...

result:

ok ok

Test #32:

score: 0
Accepted
time: 218ms
memory: 33268kb

input:

1700 2000
BBWWWBBWBBWBBWBWWBBBBBWBBBWBBWWWBWWWWBWBWBWWBWWWBBBWBBWWWBBBBWWBWBBBBBWBWBWWBWWBWWWBBBBWBWBBWWBBWWWWWWBBWBBBBBWBBWBBWWBWBWBWBWBBBWWBWBWBWBBBWBBWBWBWWWWBBWWWWWBWWBBWWBWBWWBBWBBBBBBBWBWWBWWBBBWWWWWWBWBWWBBWBBBWBBWBBWWBBWBWBWWWBWBWWWBWWWBWWWBWBWBWBWBBBWWBWBBWWBWWBBBWWBBBWBBWWBWWWBBWBWWWBWWWWB...

output:

1
3233322322322323322222322232233323333232323323332223223332222332322222323233233233322223232233223333332232222232232233232323232223323232322232232323333223333323322332323322322222223233233222333333232332232223223223322323233323233323332333232323232223323223323322233222322332333223233323333233333222...

result:

ok ok

Test #33:

score: 0
Accepted
time: 227ms
memory: 35208kb

input:

1800 2000
BWBWWWBWWBBWBWWWBWBBWBBBBWWWBBBWBWWWBWBWWWWWWBWWBBWBWWBBWWWBBBBWWBWBBWBWBBBWWBWBWWBWBBWWWWBWWWWWWBWBWWWBBBWBWBBBWBWBWBWWBBBWWBBWWBBBBBBWWWWBWBWWWWWWBWBWBBWWBWWBWWWWWBWBWWBWWBBWBBBWWWBWWBWWBBBWBBWWWWBWBWBBBBBWBBBWWWWBWWWWWBBBBBWBBBBWBBBBWWWWWBWWWWWWWBWBBBWWWBBBBBBWBWWBBBWBBBWWWBWBWBBBWBWWBW...

output:

1
3323332332232333232232222333222323332323333332332232332233322223323223232223323233232233332333333232333222323222323232332223322332222223333232333333232322332332333332323323322322233323323322232233332323222223222333323333322222322223222233333233333332322233322222232332223222333232322232332323332322...

result:

ok ok

Test #34:

score: 0
Accepted
time: 250ms
memory: 36972kb

input:

1900 2000
BWBWBWBBWWWWWBWBWBBWBWBBWWWBWWWBBBBBBWWWBWWBWBBWBBBWWWBBBWBWBWWWBBBWWWBBBBBWWBBBWWWWWWWBBBBBBWBBBWWWWBBBBBWBBWWWWWWBWBWWBWBBWBWBWBWBBBWWWWBBBWBWWBWWWBBBWBWBWWBBBWBBBWWBWWBBWBBWWBWBBWWWWWBBWBBBWWBBWBWWBBBBBWWWWWWWBBBBWWWBWWBBWBWWWWWBWBBWWBWBBWBBWBWBWWBWWBBWWBWWWWBBBBBWWBWBWWWBBWWWWWWWBBBWWW...

output:

1
3323232233333232322323223332333222222333233232232223332223232333222333222223322233333332222223222333322222322333333232332322323232322233332223233233322232323322232223323322322332322333332232223322323322222333333322223332332232333332322332322322323233233223323333222223323233322333333322233333323222...

result:

ok ok

Test #35:

score: 0
Accepted
time: 263ms
memory: 38668kb

input:

2000 2000
BBBWBBBBWBWBWBBBWBBWWBWBWWBBBWBBWWWBWBWWBWBBBWBWWBWWWBWWBWBBWWBWBBBBWWBWBBBBBBWBBWBWBBWBBWWWBWBBBWBBWWBBWWBWWBWBBBBWBBWWBWWBBBWWWBBWBWWWWBBBWWBBBBWBBWWWWWBBWWBBWWBBWWWBBBBWWWWBWBWWWWBBWWWWWWBWBBBBBWBWWWWBBWWBWWBWWWBWBBBBBWBBWWWBWBWBWBBBBBBWBBWWBBWWWBWBWWBWWWBBWWWWBBWBBBBWWWWBWBBBWWBWWWWWBB...

output:

1
3223222232323222322332323322232233323233232223233233323323223323222233232222223223232232233323222322332233233232222322332332223332232333322233222232233333223322332233322223333232333322333333232222232333322332332333232222232233323232322222232233223332323323332233332232222333323222332333332232223233...

result:

ok ok

Test #36:

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

input:

2000 1
W
W
B
W
B
B
B
W
W
W
W
B
B
W
B
B
W
W
B
W
B
W
W
B
B
B
B
B
W
B
W
W
B
B
W
B
B
W
W
W
B
W
W
W
W
B
B
W
B
B
B
B
W
B
W
W
B
B
W
B
W
B
B
B
B
W
W
B
B
B
B
W
B
W
B
W
W
W
B
B
B
W
W
B
W
W
B
W
W
W
W
B
W
W
B
B
W
W
B
W
W
B
W
W
B
B
W
W
B
B
W
W
B
W
W
W
W
B
B
W
W
B
B
W
W
B
W
W
B
W
W
B
W
W
B
B
W
B
W
W
B
B
W
B
W
B
B...

output:

1
3
2
3
2
3
3
3
2
2
2
2
3
3
2
3
3
2
2
3
2
3
2
2
3
3
3
3
3
2
3
2
2
3
3
2
3
3
2
2
2
3
2
2
2
2
3
3
2
3
3
3
3
2
3
2
2
3
3
2
3
2
3
3
3
3
2
2
3
3
3
3
2
3
2
3
2
2
2
3
3
3
2
2
3
2
2
3
2
2
2
2
3
2
2
3
3
2
2
3
2
2
3
2
2
3
3
2
2
3
3
2
2
3
2
2
2
2
3
3
2
2
3
3
2
2
3
2
2
3
2
2
3
2
2
3
3
2
3
2
2
3
3
2
3
2
3
3
2
3
...

result:

ok ok