为啥最后一个点挂了啊?据说那个点是卡memset的,但是我这WA是什么鬼?有大佬帮忙找一下Bug吗?
#include <iostream>
using namespace std;
#define MAX_N 100010
#define int long long
int T;
signed main(){
cin >> T;
while(T--){
int n,ans = 0;
char map[21][MAX_N];
cin >> n;
for(int i = 1;i <= 2;i++)
for(int j = 1;j <= n;j++)
cin >> map[i][j];
for(int j = 1;j <= n;j++){
for(int i = 1;i <= 2;i++){
if(map[i][j] == '1'){
if(i == 1){
if(map[i][j-1] == '0')
map[i][j-1] = map[i][j] = '-';
else if(map[i+1][j] == '0')
map[i+1][j] = map[i][j] = '-';
else if(map[i][j+1] == '0')
map[i][j+1] = map[i][j] = '-';
else
ans = -1;
}
else{
if(map[i][j-1] == '0')
map[i][j-1] = map[i][j] = '-';
else if(map[i-1][j] == '0')
map[i-1][j] = map[i][j] = '-';
else if(map[i][j+1] == '0')
map[i][j+1] = map[i][j] = '-';
else
ans = -1;
}
}
}
}
if(ans == -1) cout << "++" << endl;
else cout << "RP" << endl;
}
return 0;
}