QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#87085 | #3002. Busy Board | Fanch100 | Compile Error | / | / | C++14 | 2.6kb | 2023-03-11 16:56:50 | 2023-03-11 16:56:52 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-03-11 16:56:52]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-03-11 16:56:50]
- 提交
answer
#include<bits/stdc++.h>
using namespace std;
const int N = 1010;
int n, m;
bool ma1[N][N], ma2[N][N];
int sum1[N], sum2[N];
bool check(){
for (int i=1;i<=n;++i){
for (int j=1;j<=m;++j){
if (ma1[i][j]!=ma2[i][j]) return 0;
}
}
return 1;
}
bool pt1[N], pt2[N];//行列是否被涂色
bool used[N][N];
int main(){
cin>>n>>m;
for (int i=1;i<=n;++i){
string s;cin>>s;
for (int j=1;j<=m;++j) ma1[i][j]=(s[j-1]=='X');
}
for (int i=1;i<=n;++i){
string s;cin>>s;
for (int j=1;j<=m;++j) ma2[i][j]=(s[j-1]=='X');
}
if (check()){
puts("1");
return 0;
}
for (int i=1;i<=n;++i){
for (int j=1;j<=m;++j) {
sum1[i]+=ma2[i][j];
sum2[j]+=ma2[i][j];
}
}
int cc=0;
while(1){
bool doit=0;
for (int i=1;i<=n;++i){
for (int j=1;j<=m;++j){
if (used[i][j]) continue;
if (sum1[i]==1 && sum2[j]==1 && !pt1[i] && !pt2[j] && ma2[i][j]) used[i][j]=1;
else if ((pt1[i] && !pt2[j] && !sum2[j]) || (!pt1[i] && pt2[j] && !sum1[i])) used[i][j]=1;
if (used[i][j]){
doit=1;
if (ma2[i][j]){
ma2[i][j]=0;
sum1[i]--; sum2[j]--;
}
for (int k=1;k<=m;++k){
sum1[i]-=ma2[i][k];
ma2[i][k]=0;
}
for (int k=1;k<=n;++k){
sum2[j]-=ma2[k][j];
ma2[k][j]=0;
}
pt1[i]=pt2[j]=1;
}
}
}
// printf("testcase %d:\n",++cc);
// for (int i=1;i<=n;++i){
// for (int j=1;j<=m;++j) printf("%d ",used[i][j]); puts("");
// }
if (!doit) break;
}
bool flag1=0, flag2=1;
for (int i=1;i<=n;++i){
for (int j=1;j<=m;++j){
if (pt1[i] && pt[j] && !ma1[i][j]) flag1=1;//不能用used i j hack见下
if (!pt1[i] && !pt2[j] && ma2[i][j]!=ma1[i][j]) flag2=0;
}
}
for (int i=1;i<=n;++i){
for (int j=1;j<=m;++j) printf("%d ",used[i][j]); puts("");
}
printf("flag=%d %d\n",flag1,flag2);
if (flag1 && flag2) puts("1");
else puts("0");
return 0;
}
/*
7 7
XXOOOOX
XXOOOOO
OOXXOOO
OOXXOOO
OOOOXXX
OOOOXOX
OOOOXXX
XXOOOOO
XXOOOOO
OOXXOOO
OOXXOOO
OOOOOOO
OOOOOOO
OOOOOOX
*/
Details
answer.code: In function ‘int main()’: answer.code:73:27: error: ‘pt’ was not declared in this scope; did you mean ‘pt2’? 73 | if (pt1[i] && pt[j] && !ma1[i][j]) flag1=1;//不能用used i j hack见下 | ^~ | pt2