QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#509440 | #8020. Mine Sweeper II | Xunwuqishi# | WA | 0ms | 3684kb | C++23 | 1.1kb | 2024-08-08 14:52:17 | 2024-08-08 14:52:17 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) x&(-x)
#define int long long
const int N = 2e5+10;
int mod = 1e6+7;
//int mod = 1e9+7;
//int ways[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
int n,m;
string a[1010],b[1010];
void solve() {
cin>>n>>m;
for(int i = 0;i<n;i++) cin>>a[i];
for(int i = 0;i<n;i++) cin>>b[i];
int su = 0;
for(int i = 0;i<n;i++) for(int j = 0;j<m;j++) su += a[i][j] != b[i][j];
if(su <= (n+m)/2){
for(int i = 0;i<n;i++) cout<<a[i]<<endl;
return;
}
for(int i = 0;i<n;i++) for(int j = 0;j<m;j++){
if(a[i][j] == 'X') a[i][j] = '.';
else a[i][j] = 'X';
}
su = 0;
for(int i = 0;i<n;i++) for(int j = 0;j<m;j++) su += a[i][j] != b[i][j];
if(su <= (n+m)/2){
for(int i = 0;i<n;i++) cout<<a[i]<<endl;
return;
}
cout<<-1<<endl;
}
signed main() {
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout<<fixed<<setprecision(10);
int caset = 1;
//cin>>caset;
for(int i = 1;i<=caset;i++){
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3684kb
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: 3636kb
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:
-1
result:
wrong answer Line "-1" doesn't correspond to pattern "[.X]{28}"