QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#88860 | #3002. Busy Board | XZTmaxsmall67 | WA | 11ms | 5644kb | C++14 | 904b | 2023-03-17 20:02:57 | 2023-03-17 20:03:00 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1e3+100;
int n,m;
char s[N][N],t[N][N];
int cntr[N],cntl[N];
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++)scanf("%s",t[i]+1);
auto check=[&]()->bool{for(int i=1;i<=n;i++)for(int j=1;j<=m;j++)if(t[i][j]&&s[i][j]!=t[i][j])return 0;return 1;};
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
cntl[j]+=t[i][j]=='X',cntr[j]+=t[i][j]=='X';
if(check())return puts("1"),0;
while(1)
{
int px=0,py=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)
if(cntl[i]==1&&cntr[j]==1){px=i,py=j;break;}
if(!px)break;cntl[px]--;cntr[py]--;
for(int i=1;i<=n;i++)t[i][py]=0;
for(int j=1;j<=m;j++)t[px][j]=0;
}
int tot=0;
for(int i=1;i<=n;i++)
for(int j=1;j<=m;j++)if(s[i][j]=='X'&&!t[i][j])tot=1;
if(check()&&tot)return puts("1"),0;
puts("0");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 6ms
memory: 5024kb
input:
769 998 OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...
output:
0
result:
ok answer is 0
Test #2:
score: 0
Accepted
time: 11ms
memory: 5644kb
input:
977 998 OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...
output:
0
result:
ok answer is 0
Test #3:
score: -100
Wrong Answer
time: 4ms
memory: 5300kb
input:
941 973 XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
output:
0
result:
wrong answer expected 1, found 0