QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#769128 | #9621. 连方 | YFffffff | WA | 11ms | 5964kb | C++23 | 1.7kb | 2024-11-21 16:13:41 | 2024-11-21 16:13:43 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int N = 2e5 + 10, INF = 1e18, MOD = 1e9 + 7;
typedef pair<int, int> PII;
typedef unsigned long long ull;
int dx[] = {0, 0, 1, -1}, dy[] = {1, -1, 0, 0};
int arr[N], brr[N];
map<int,int> mp;
map<PII,int> mpp;
vector<PII> vi, g[N];
vector<int> ans;
bool st[N];
int n, m, k;
void solve()
{
cin >> n;
string a;
string b;
cin >> a >> b;
string a1 = " " + a + " ";
string b1 = " " + b + " ";
if((int)a.find('.') != -1 && (int)b.find('.') != -1){
string t1 = "", t2 = "", t3 = "" , t4 = "", t5 = "";
for(int i = 1; i < (int)a1.size() - 1; i ++){
if(a1[i] == '.' ) t1 += '#';
else{
t1 += '.';
}
if(b1[i] == '.' ) t4 += '#';
else{
t4 += '.';
}
}
int cnt = 0;
int l = 0,r = 0;
for(int i = 0; i < n - 1; i ++){
if(t1[i] =='#' && t1[i + 1] != '#' && !cnt){
t2 += ".#";
cnt ++;
l = i;
}else{
t2 += '.';
}
}
cnt = 0;
for(int i = 0; i < n - 1; i ++){
if(t4[i] == '#' && t4[i + 1] != '#' && !cnt){
t5 += ".#";
cnt ++;
r = i;
}else{
t5 += ".";
}
}
for(int i = 0; i < n; i ++){
if(i == l + 1 || i == r + 1) t3 += ".";
else t3 += '#';
}
cout << "YES\n";
cout << a << "\n" << t1 << "\n" << t2 << "\n" << t3 << "\n" << t5 << "\n" << t4 << '\n' << b << "\n";
return;
}else if((int)a.find('.') == -1 && (int)b.find('.') == -1){
cout << "YES\n";
for(int i = 0; i < 7; i ++) cout << a << "\n";
return;
}
cout << "NO\n";
}
signed main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int T = 1;
cin >> T;
while (T --) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 5852kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
YES #..# .##. ...# #.#. .#.. #..# .##. YES ##.#. ..#.# ...#. #.#.# .#... #.#.. .#.## NO YES .######.######.####.#.##### #......#......#....#.#..... .#......................... #.######################### .#......................... #....###....##.#######..... .####...####..#.......##### YES ########...
result:
ok Correct.
Test #2:
score: -100
Wrong Answer
time: 11ms
memory: 5964kb
input:
10000 6 .#..## ..#... 5 #..#. ##... 6 .###.# ...### 17 .####..#######..# ###########.##### 6 ..##.# #.##.# 25 #.##.##############.####. ####################.##.# 9 ##.#..##. ##..##### 6 .###.# ##.### 6 ###..# #.#### 25 #####################.#.# ######.################## 6 .#.### .##..# 6 ..#### #......
output:
YES .#..## #.##.. .#.... #..### ..#... ##.### ..#... YES #..#. .##.# ...#. #.#.# .... ..### ##... YES .###.# #...#. .#.... #.#.## ...#.. ###... ...### YES .####..#######..# #....##.......##. .#............... #.##########.#### ............#.... ...........#..... ###########.##### YES ..##.# ##..#. ....
result:
wrong answer Testcase 1: Connected condition failed.