QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#471539#8020. Mine Sweeper IIsmlWA 0ms3716kbC++17813b2024-07-10 21:53:282024-07-10 21:53:30

Judging History

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

  • [2024-07-10 21:53:30]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3716kb
  • [2024-07-10 21:53:28]
  • 提交

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

Details

Tip: Click on the bar to expand more detailed information

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