QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#509440#8020. Mine Sweeper IIXunwuqishi#WA 0ms3684kbC++231.1kb2024-08-08 14:52:172024-08-08 14:52:17

Judging History

你现在查看的是最新测评结果

  • [2024-08-08 14:52:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3684kb
  • [2024-08-08 14:52:17]
  • 提交

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}"