QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#103920 | #6377. LaLa and Magic Stone | chenshi# | WA | 18ms | 2520kb | C++ | 1.4kb | 2023-05-07 20:47:43 | 2023-05-07 20:47:45 |
Judging History
answer
#include<cstdio>
using namespace std;
const int o=1010,MOD=998244353;const char
a[3][6]={
"000",
"110",
"000"},
b[3][6]={
"010",
"010",
"000"},
c[3][6]={
"000",
"010",
"010"
},
d[4][6]={
"0001",
"0000",
"0000",
"2000"
},
e[4][6]={
"00011",
"01000",
"00010",
"22000"
},
f[5][6]={
"0001",
"0101",
"0000",
"2010",
"2000"
};
int n,m,ans=1;char s[o][o];
inline bool chk1(int I,int J,const char a[][6],int n,int m){
for(int i=0;i<n;++i) for(int j=0;j<m;++j) if(s[i+I][j+J]!=a[i][j]&&a[i][j]!='2') return false;
for(int i=I;i<I+n;++i) for(int j=J;j<J+m;++j) if(a[i][j]!='2') s[i][j]='1';
return true;
}
inline bool chk2(int I,int J,const char a[][6],int n,int m){
for(int i=0;i<n;++i) for(int j=0;j<m;++j) if(s[i+I][j+J]!=a[i][m-j-1]&&a[i][m-j-1]!='2') return false;
for(int i=I;i<I+n;++i) for(int j=J;j<J+m;++j) if(a[i][m-j-1]!='2') s[i][j]='1';
return true;
}
inline bool chk(int I,int J,const char a[][6],int n,int m){
return chk1(I,J,a,n,m)||chk2(I,J,a,n,m);
}
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(!chk(i,j,a,3,3)) if(!chk(i,j,b,3,3)) if(!chk(i,j,c,3,3))
if(!chk(i,j,e,4,5)) if(!chk(i,j,f,5,4)) if(chk(i,j,d,4,4)) ans=ans*2%MOD;
for(int i=1;i<=n;++i) for(int j=1;j<=m;++j) if(s[i][j]=='0') ans=0;
printf("%d",ans);
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 1488kb
input:
4 4 0001 0000 0000 1000
output:
2
result:
ok 1 number(s): "2"
Test #2:
score: 0
Accepted
time: 1ms
memory: 1760kb
input:
5 4 0001 0101 0000 1010 1000
output:
1
result:
ok 1 number(s): "1"
Test #3:
score: 0
Accepted
time: 1ms
memory: 1500kb
input:
3 3 111 111 111
output:
1
result:
ok 1 number(s): "1"
Test #4:
score: 0
Accepted
time: 1ms
memory: 1740kb
input:
3 4 1111 1111 1111
output:
1
result:
ok 1 number(s): "1"
Test #5:
score: 0
Accepted
time: 1ms
memory: 1876kb
input:
3 1000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
1
result:
ok 1 number(s): "1"
Test #6:
score: 0
Accepted
time: 1ms
memory: 1756kb
input:
4 3 111 111 111 111
output:
1
result:
ok 1 number(s): "1"
Test #7:
score: 0
Accepted
time: 1ms
memory: 1744kb
input:
4 4 1111 1111 1111 1111
output:
1
result:
ok 1 number(s): "1"
Test #8:
score: 0
Accepted
time: 1ms
memory: 1744kb
input:
4 1000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
1
result:
ok 1 number(s): "1"
Test #9:
score: 0
Accepted
time: 1ms
memory: 2424kb
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: 1ms
memory: 2520kb
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: 18ms
memory: 2428kb
input:
1000 1000 11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111...
output:
1
result:
ok 1 number(s): "1"
Test #12:
score: 0
Accepted
time: 0ms
memory: 1752kb
input:
3 3 000 010 010
output:
1
result:
ok 1 number(s): "1"
Test #13:
score: 0
Accepted
time: 1ms
memory: 1744kb
input:
3 3 000 011 000
output:
1
result:
ok 1 number(s): "1"
Test #14:
score: 0
Accepted
time: 1ms
memory: 1548kb
input:
3 3 010 010 000
output:
1
result:
ok 1 number(s): "1"
Test #15:
score: 0
Accepted
time: 1ms
memory: 1512kb
input:
3 3 000 110 000
output:
1
result:
ok 1 number(s): "1"
Test #16:
score: -100
Wrong Answer
time: 1ms
memory: 1696kb
input:
4 4 1000 0000 0000 0001
output:
0
result:
wrong answer 1st numbers differ - expected: '2', found: '0'