QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#86812 | #3002. Busy Board | CharlieVinnie | WA | 37ms | 5260kb | C++14 | 1.2kb | 2023-03-11 08:34:31 | 2023-03-11 08:34:33 |
Judging History
answer
#include <bits/stdc++.h>
#define For(i,a,b) for(int i=a;i<=b;i++)
#define Rev(i,a,b) for(int i=a;i>=b;i--)
#define Fin(file) freopen(file,"r",stdin)
#define Fout(file) freopen(file,"w",stdout)
using namespace std; using ll = long long;
const int N=1e3+5;
char mp1[N][N],mp2[N][N]; int n,m,visr[N],visc[N],cntr[N],cntc[N];
int main(){
cin>>n>>m; For(i,1,n) cin>>(mp1[i]+1);; For(i,1,n) cin>>(mp2[i]+1);
int sm=1; For(i,1,n) For(j,1,m) if(mp1[i][j]!=mp2[i][j]) { sm=0; break; }
if(sm) cout<<"1\n",exit(0);
For(i,1,n) For(j,1,m) if(mp2[i][j]=='X') cntr[i]++,cntc[j]++;
while(true){
int ok=0;
For(i,1,n) For(j,1,m) if( (mp2[i][j]=='X'&&cntr[i]==1&&cntc[i]==1) || (mp2[i][j]=='.'&&cntr[i]==0&&cntr[j]==0&&(!visr[i]||!visc[j])) ){
visr[i]=visc[j]=1;
For(k,1,m) cntr[i]-=mp2[i][k]=='X',cntc[k]-=mp2[i][k]=='X',mp2[i][k]='.';
For(k,1,n) cntr[k]-=mp2[k][j]=='X',cntc[j]-=mp2[k][j]=='X',mp2[k][j]='.';
ok=1;
}
if(!ok) break;
}
//~ For(i,1,n) cout<<mp2[i]+1<<'\n';
int ok1=0; For(i,1,n) For(j,1,m) if(mp2[i][j]=='.'&&mp1[i][j]=='O') ok1=1;
int ok2=1; For(i,1,n) For(j,1,m) if(mp2[i][j]!='.'&&mp2[i][j]!=mp1[i][j]) ok2=0;
cout<<(ok1&ok2)<<'\n';
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 27ms
memory: 4892kb
input:
769 998 OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...
output:
0
result:
ok answer is 0
Test #2:
score: 0
Accepted
time: 25ms
memory: 5260kb
input:
977 998 OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...
output:
0
result:
ok answer is 0
Test #3:
score: -100
Wrong Answer
time: 37ms
memory: 5224kb
input:
941 973 XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
output:
0
result:
wrong answer expected 1, found 0