QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#86826 | #3002. Busy Board | AFewSuns | WA | 13ms | 5348kb | C++14 | 2.3kb | 2023-03-11 09:28:00 | 2023-03-11 09:28:03 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
namespace my_std{
#define ll long long
#define bl bool
ll my_pow(ll a,ll b,ll mod){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res=(res*a)%mod;
a=(a*a)%mod;
b>>=1;
}
return res;
}
ll qpow(ll a,ll b){
ll res=1;
if(!b) return 1;
while(b){
if(b&1) res*=a;
a*=a;
b>>=1;
}
return res;
}
#define db double
#define pf printf
#define pc putchar
#define fr(i,x,y) for(register ll i=(x);i<=(y);i++)
#define pfr(i,x,y) for(register ll i=(x);i>=(y);i--)
#define go(u) for(ll i=head[u];i;i=e[i].nxt)
#define enter pc('\n')
#define space pc(' ')
#define fir first
#define sec second
#define MP make_pair
#define il inline
#define inf 8e18
#define random(x) rand()*rand()%(x)
#define inv(a,mod) my_pow((a),(mod-2),(mod))
il ll read(){
ll sum=0,f=1;
char ch=0;
while(!isdigit(ch)){
if(ch=='-') f=-1;
ch=getchar();
}
while(isdigit(ch)){
sum=sum*10+(ch^48);
ch=getchar();
}
return sum*f;
}
il void write(ll x){
if(x<0){
x=-x;
pc('-');
}
if(x>9) write(x/10);
pc(x%10+'0');
}
il void writeln(ll x){
write(x);
enter;
}
il void writesp(ll x){
write(x);
space;
}
}
using namespace my_std;
ll n,m,sum1[1010],sum2[1010];
char s[1010][1010],t[1010][1010];
bl pd1[1010],pd2[1010];
il bl chk1(){
fr(i,1,n) fr(j,1,m) if(s[i][j]!=t[i][j]) return 0;
return 1;
}
int main(){
n=read();
m=read();
fr(i,1,n) scanf("%s",s[i]+1);
fr(i,1,n) scanf("%s",t[i]+1);
if(chk1()) write(1);
else{
fr(i,1,n){
fr(j,1,m){
sum1[i]+=(t[i][j]=='X');
sum2[j]+=(t[i][j]=='X');
}
}
bl ck;
do{
ck=0;
fr(i,1,n){
fr(j,1,m){
if(pd1[i]&&pd2[j]) continue;
bl o=0;
if(!pd1[i]&&!pd2[j]&&sum1[i]==1&&sum2[j]==1&&t[i][j]=='X') o=1;
if((pd1[i]||pd2[j])&&!sum1[i]&&!sum2[j]) o=1;
if(o){
ck=1;
fr(k,1,m){
sum1[i]-=(t[i][k]=='X');
sum2[k]-=(t[i][k]=='X');
}
fr(k,1,n){
sum1[k]-=(t[k][j]=='X');
sum2[j]-=(t[k][j]=='X');
}
pd1[i]=pd2[j]=1;
}
}
}
}while(ck);
ck=0;
bl ck2=0;
fr(i,1,n) fr(j,1,m) if(pd1[i]&&pd2[j]&&s[i][j]=='O') ck=1;
fr(i,1,n) fr(j,1,m) if(!pd1[i]&&!pd2[j]&&s[i][j]!=t[i][j]) ck2=1;
write(ck&(!ck2));
}
}
詳細信息
Test #1:
score: 100
Accepted
time: 13ms
memory: 5104kb
input:
769 998 OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...
output:
0
result:
ok answer is 0
Test #2:
score: 0
Accepted
time: 10ms
memory: 5292kb
input:
977 998 OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...
output:
0
result:
ok answer is 0
Test #3:
score: -100
Wrong Answer
time: 7ms
memory: 5348kb
input:
941 973 XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
output:
0
result:
wrong answer expected 1, found 0