QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#788150 | #9621. 连方 | Lonelyper# | WA | 0ms | 3652kb | C++17 | 2.0kb | 2024-11-27 16:04:32 | 2024-11-27 16:04:33 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
string s1, s2;
int n;
void Lonelyper(){
cin >> n >> s1 >> s2;
int cnt1 = 0, cnt2 = 0;
vector<vector<char>> ans(8, vector<char> (n + 1));
for(int i = 0; i < n; i ++){
ans[1][i] = s1[i];
ans[7][i] = s2[i];
if(s1[i] == '.') ans[2][i] = '#';
else ans[2][i] = '.', cnt1 ++;
if(s2[i] == '.') ans[6][i] = '#';
else ans[6][i] = '.', cnt2 ++;
}
if(cnt1 == n || cnt2 == n){
cout << "NO" << endl;
return;
}
int l1 = -1, l2 = -1;
for(int i = 0; i < n; i ++){
if(i >= 1 && ans[2][i] == '.' && ans[2][i - 1] == '#'){
ans[3][i] = '#';
l1 = i;
break;
}
if(i < n - 1 && ans[2][i] == '.' && ans[2][i + 1] == '#'){
ans[3][i] = '#';
l1 = i;
break;
}
}
for(int i = 0; i < n; i ++){
if(i >= 1 && ans[6][i] == '.' && ans[6][i - 1] == '#'){
ans[5][i] = '#';
l2 = i;
break;
}
if(i < n - 1 && ans[6][i] == '.' && ans[6][i + 1] == '#'){
ans[5][i] = '#';
l2 = i;
break;
}
}
// cout << l1 << ' ' << l2 << endl;
if(l1 > l2) swap(l1, l2);
if(abs(l1 - l2) == 1){
ans[4][l1] = '#';
}
else if(l1 == l2){
ans[4][l1] = '#';
}
else{
for(int j = l1 + 1; j < l2; j ++){
ans[4][j] = '#';
}
}
for(int i = 1; i <= 7; i ++){
for(int j = 0; j < n; j ++){
if(ans[i][j] != '#') ans[i][j] = '.';
}
}
cout << "YES" << endl;
for(int i = 1; i <= 7; i ++){
for(int j = 0; j < n; j ++){
cout << ans[i][j];
}
cout << endl;
}
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
cin >> t;
while(t --) Lonelyper();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3652kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
YES #..# .##. #... #... .#.. #..# .##. YES ##.#. ..#.# .#... .#... .#... #.#.. .#.## NO YES .######.######.####.#.##### #......#......#....#.#..... .#......................... .#......................... .#......................... #....###....##.#######..... .####...####..#.......##### NO
result:
wrong answer Testcase 5: output is NO, but jury's answer is YES.