QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#87083 | #3002. Busy Board | yx20220802 | WA | 38ms | 5340kb | C++14 | 2.2kb | 2023-03-11 16:54:27 | 2023-03-11 16:54:28 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
namespace IO_ER{
#define LL long long
#define db double
#define ULL unsigned long long
#define In inline
#define f(a,b,i) for(int i=a;i<=b;i++)
#define ff(a,b,i) for(int i=a;i<b;i++)
#define f_(a,b,i) for(int i=a;i>=b;i--)
#define ff_(a,b,i) for(int i=a;i>b;i--)
typedef pair<int,int> Pi;
int inf=0x3f3f3f3f;
int INF=0x7fffffff;
LL infll=0x3f3f3f3f3f3f3f3fll;
LL INFll=0x7fffffffffffffffll;
int FLAG_=0;
char CHAR=0;
template<typename T>void read(T &x){
x=0;
FLAG_=0;
CHAR=getchar();
while(CHAR<'0'||'9'<CHAR){
if(CHAR=='-')FLAG_=1;
CHAR=getchar();
}
while('0'<=CHAR&&CHAR<='9'){
x=(x<<1)+(x<<3)+(CHAR^48);
CHAR=getchar();
}
x=FLAG_?-x:x;
}
template<typename T,typename ...Args>void read(T &x,Args &...args){
read(x);
read(args...);
}
}
using namespace IO_ER;
#define N 1050
int n,m;
int r[N];
int c[N];
char st[N][N];
char ed[N][N];
int vir[N];
int vic[N];
int main(){
// freopen("ccc.in","r",stdin);
// freopen("ccc.out","w",stdout);
read(n,m);
f(1,n,i)cin>>st[i]+1;
f(1,n,i)cin>>ed[i]+1;
int fl=1;
f(1,n,i){
f(1,m,j){
if(st[i][j]!=ed[i][j]){
fl=0;
break;
}
}
if(!fl)break;
}
if(fl){
puts("1");
return 0;
}
f(1,n,i){
f(1,m,j){
if(ed[i][j]=='X'){
r[i]++;
c[j]++;
}
}
}
fl=1;
while(fl){
fl=0;
f(1,n,i){
f(1,n,j){
// if(vir[i]&&vic[j]||ed[i][j]=='O')continue;
// if((ed[i][j]=='X'&&r[i]==1&&c[j]==1)||(ed[i][j]=='?'&&r[i]==0&&c[j]==0)){
if((ed[i][j]=='X'&&r[i]==1&&c[j]==1)||(ed[i][j]=='?'&&r[i]==0&&c[j]==0&&(!vir[i]||!vic[j]))){
fl=1;
vir[i]=1;
vic[j]=1;
f(1,m,k){
r[i]-=(ed[i][k]=='X');
c[k]-=(ed[i][k]=='X');
ed[i][k]='?';
}
f(1,n,k){
r[k]-=(ed[k][j]=='X');
c[j]-=(ed[k][j]=='X');
ed[k][j]='?';
}
}
}
}
}
int fll=0;
f(1,n,i){
if(!vir[i])continue;
f(1,m,j){
if(!vic[j])continue;
fll|=(st[i][j]=='O');
}
}
// if(!fl){
// puts("0");
// return 0;
// }
fl=1;
f(1,n,i){
f(1,m,j){
fl&=(ed[i][j]=='?'||st[i][j]==ed[i][j]);
}
}
if(fl&fll)puts("1");
else puts("0");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 30ms
memory: 4984kb
input:
769 998 OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...
output:
0
result:
ok answer is 0
Test #2:
score: 0
Accepted
time: 38ms
memory: 5308kb
input:
977 998 OOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOO...
output:
0
result:
ok answer is 0
Test #3:
score: 0
Accepted
time: 31ms
memory: 5340kb
input:
941 973 XOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXOXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
output:
1
result:
ok answer is 1
Test #4:
score: 0
Accepted
time: 2ms
memory: 3432kb
input:
65 983 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
output:
0
result:
ok answer is 0
Test #5:
score: 0
Accepted
time: 2ms
memory: 3584kb
input:
50 201 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX...
output:
0
result:
ok answer is 0
Test #6:
score: 0
Accepted
time: 22ms
memory: 5300kb
input:
949 507 OXOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOXOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO...
output:
1
result:
ok answer is 1
Test #7:
score: 0
Accepted
time: 37ms
memory: 5328kb
input:
964 994 XOOOOOOOOOOOOOOOOXXXXOOXXOOOOOOOOOOOOXXOOOOXOOOOOOOOOOOXOOXOOXOOOOXOXOXOOOOOOOXOOXOOOOOOOOXOOXXOXOOOOOXOXOXOOOOOOOOOXOXOOOOOOOXXOOOOOOOOOXOOOXOXOOOOOOXXXXOOOOOOOOOOOOOOOOOXOOXOOOOOOOOOXOOOXXXOOOOOOOOOOOOXOOOOOXOXXOOOOOOOXOOOXOOOXOOOOOOOOOOXOOOOOOOXXOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOXOOOXXOXXOO...
output:
0
result:
ok answer is 0
Test #8:
score: 0
Accepted
time: 6ms
memory: 5296kb
input:
992 30 OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOXOOO OOXOOOOOXOOOOOOOOOXOOOOOOOOOOO OOOOOOXOOOOOOOOOOOOXOOOOOOOOOO OOOOOOOOOOOOOOOOOOOXOOOOOOOOOO OOXOOOOOOOOOOXOOOOXOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOOOOO OOOOOOOOOOOOOOOXOOOOOOOOOOOOOO OOOOOOOOOOOOOOOOOOOOOOOOOOXOOO OXOOOOOOOOOOOO...
output:
0
result:
ok answer is 0
Test #9:
score: 0
Accepted
time: 34ms
memory: 5316kb
input:
964 812 OOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOXOOOOOOOOOOOXXOOOOOOOOOOOOOOOOOOOOOOOOOXOOOXOOOOOOOOOOXOOOOOOOOOXOOXXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOXOOXOXOOOOOOOOOXOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOXOOOXOOOOOOOOOXOOOOOOO...
output:
1
result:
ok answer is 1
Test #10:
score: 0
Accepted
time: 16ms
memory: 4116kb
input:
375 970 OXOXOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOXOOOOXOOOOOOOOXOOOOOXOOOOOOOOOOOXOOOOXOOXOOOOOOOOOXOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOXXOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOXOXOOOOOOXXOXOOOOOOOOOOXOOOOOOOXOOXXOOXOXXOOXXOOOOOXXOXOOOOOOOXOOXOOOOOOOOOOOOXOXOOXOOOOOOOOOOOOOXXXOOOOOOOOOOOXOOOOOXOXOXOOOOO...
output:
0
result:
ok answer is 0
Test #11:
score: -100
Wrong Answer
time: 2ms
memory: 3636kb
input:
116 926 XXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXOXXXXXXXXXXXXXXXXXXOXXXXXOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXOXXXXXXXXXXX...
output:
0
result:
wrong answer expected 1, found 0