QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#471539 | #8020. Mine Sweeper II | sml | WA | 0ms | 3716kb | C++17 | 813b | 2024-07-10 21:53:28 | 2024-07-10 21:53:30 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int N=1010;
char a[N][N],b[N][N];
int n,m;
void solve()
{
cin>>n>>m;
for(int i=1;i<=n;i++) cin>>(a[i]+1);
int u=0;
int u2=0;
int u3=0;
int u4=0;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cin>>b[i][j];
if(a[i][j]=='.') u3++;
if(b[i][j]=='X') u4++;
if(a[i][j]=='.'&&b[i][j]=='X') u2++;
if(a[i][j]!=b[i][j]) u++;
}
}
int sum=u4+u3-2*u2;
if(u<=(n*m)/2){
for(int i=1;i<=n;i++) cout<<(a[i]+1);
}
else if(sum<=(n*m)/2){
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
if(a[i][j]=='.') cout<<'X';
else cout<<'.';
}
cout<<'\n';
}
}
else cout<<-1<<'\n';
}
signed main(){
ios::sync_with_stdio(false);
cin.tie(0),cout.tie(0);
int T=1;
while(T--) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3668kb
input:
2 4 X..X X.X. X.X. .X..
output:
.XX. .X.X
result:
ok OK, Accepted.
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3716kb
input:
7 28 ............................ .XXXXX...XXXX..XXXX....XXXX. ...X....XX.....X..XX..XX.... ...X....X......XXXX...X..... ...X....XX.....X......XX.... .XXXXX...XXXX..X.......XXXX. ............................ ............................ ..XXXX...XXXX..XXXXX..X...X. .XX.....XX.......X....X...X. .X......
output:
.............................XXXXX...XXXX..XXXX....XXXX....X....XX.....X..XX..XX.......X....X......XXXX...X........X....XX.....X......XX.....XXXXX...XXXX..X.......XXXX.............................
result:
wrong answer Line ".............................X...XX............................." doesn't correspond to pattern "[.X]{28}"