QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#103909#6377. LaLa and Magic Stonechenshi#WA 9ms2544kbC++1.8kb2023-05-07 20:22:222023-05-07 20:22:23

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-07 20:22:23]
  • 评测
  • 测评结果:WA
  • 用时:9ms
  • 内存:2544kb
  • [2023-05-07 20:22:22]
  • 提交

answer

#include<cstdio>
using namespace std;
const int o=1010,MOD=998244353;
int n,m,ans=1;char s[o][o];
int main(){
	scanf("%d%d",&n,&m);
	for(int i=1;i<=n;++i) scanf("%s",s[i]+1);
	for(int i=1;i<=n;++i) for(int j=1;j<=m;++j) if(s[i][j]=='0'){
		if(s[i][j+2]!='0'||s[i+2][j]!='0'||s[i+2][j+2]!='0'){printf("0");return 0;}
		if(s[i+1][j+1]=='0'){
			if(s[i][j+1]!='0'||s[i][j+2]!='0'||s[i][j+3]!='1'
			||s[i+1][j]!='0'||s[i+1][j+1]!='0'||s[i+1][j+2]!='0'||s[i+1][j+3]!='0'
			||s[i+2][j]!='0'||s[i+2][j+1]!='0'||s[i+2][j+2]!='0'||s[i+2][j+3]!='0'
			||s[i+3][j]!='1'||s[i+3][j+1]!='0'||s[i+3][j+2]!='0'||s[i+3][j+3]!='0'){printf("0");return 0;}
			ans=ans*2%MOD;
			for(int k=i;k<=i+3;++k) for(int $=j;$<=j+3;++$) s[k][$]='1';
		}
		else{
			if((s[i][j+1]=='1')+(s[i+1][j]=='1')+(s[i+1][j+2]=='1')+(s[i+2][j+1]=='1')==1)
				for(int k=i;k<=i+2;++k) for(int $=j;$<=j+2;++$) s[k][$]='1';
			else if(s[i][j+1]=='0'&&s[i][j+2]=='0'&&s[i][j+3]=='1'&&s[i][j+4]=='1'
			&&s[i+1][j]=='0'&&s[i+1][j+1]=='1'&&s[i+1][j+2]=='0'&&s[i+1][j+3]=='0'&&s[i+1][j+4]=='0'
			&&s[i+2][j]=='0'&&s[i+2][j+1]=='0'&&s[i+2][j+2]=='0'&&s[i+2][j+3]=='1'&&s[i+2][j+4]=='0'
			&&s[i+3][j]=='1'&&s[i+3][j+1]=='1'&&s[i+3][j+2]=='0'&&s[i+3][j+3]=='0'&&s[i+3][j+4]=='0')
				for(int k=i;k<=i+3;++k) for(int $=j;$<=j+4;++$) s[k][$]='1';
			else if(s[i][j+1]=='0'&&s[i][j+2]=='0'&&s[i][j+3]=='1'
			&&s[i+1][j]=='0'&&s[i+1][j+1]=='1'&&s[i+1][j+2]=='0'&&s[i+1][j+3]=='1'
			&&s[i+2][j]=='0'&&s[i+2][j+1]=='0'&&s[i+2][j+2]=='0'&&s[i+2][j+3]=='0'
			&&s[i+3][j]=='1'&&s[i+3][j+1]=='0'&&s[i+3][j+2]=='1'&&s[i+3][j+3]=='0'
			&&s[i+4][j]=='1'&&s[i+4][j+1]=='0'&&s[i+4][j+2]=='0'&&s[i+4][j+3]=='0')
				for(int k=i;k<=i+4;++k) for(int $=j;$<=j+3;++$) s[k][$]='1';
			else{printf("0");return 0;}
		}
	}
	printf("%d",ans);
	return 0;
}

詳細信息

Test #1:

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

input:

4 4
0001
0000
0000
1000

output:

2

result:

ok 1 number(s): "2"

Test #2:

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

input:

5 4
0001
0101
0000
1010
1000

output:

1

result:

ok 1 number(s): "1"

Test #3:

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

input:

3 3
111
111
111

output:

1

result:

ok 1 number(s): "1"

Test #4:

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

input:

3 4
1111
1111
1111

output:

1

result:

ok 1 number(s): "1"

Test #5:

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

input:

3 1000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #6:

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

input:

4 3
111
111
111
111

output:

1

result:

ok 1 number(s): "1"

Test #7:

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

input:

4 4
1111
1111
1111
1111

output:

1

result:

ok 1 number(s): "1"

Test #8:

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

input:

4 1000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #9:

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

input:

1000 3
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
111
1...

output:

1

result:

ok 1 number(s): "1"

Test #10:

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

input:

1000 4
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
1111
111...

output:

1

result:

ok 1 number(s): "1"

Test #11:

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

input:

1000 1000
11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...

output:

1

result:

ok 1 number(s): "1"

Test #12:

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

input:

3 3
000
010
010

output:

1

result:

ok 1 number(s): "1"

Test #13:

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

input:

3 3
000
011
000

output:

1

result:

ok 1 number(s): "1"

Test #14:

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

input:

3 3
010
010
000

output:

1

result:

ok 1 number(s): "1"

Test #15:

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

input:

3 3
000
110
000

output:

1

result:

ok 1 number(s): "1"

Test #16:

score: -100
Wrong Answer
time: 1ms
memory: 1876kb

input:

4 4
1000
0000
0000
0001

output:

0

result:

wrong answer 1st numbers differ - expected: '2', found: '0'