QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#87079 | #3002. Busy Board | yx20220802 | WA | 6ms | 5064kb | C++14 | 2.3kb | 2023-03-11 16:53:26 | 2023-03-11 16:53:27 |
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)scanf("%s",st[i]+1);
f(1,n,i)scanf("%s",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("1");
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 6ms
memory: 5064kb
input:
769 998 OOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOXOOOOOOOOOOOOOOOOOOOO...
output:
1
result:
wrong answer expected 0, found 1