QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#769117 | #9621. 连方 | YFffffff | WA | 1ms | 5672kb | C++23 | 1.8kb | 2024-11-21 16:11:14 | 2024-11-21 16:11:14 |
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] == '.' && (a1[i - 1] == '#' || a1[i + 1] == '#')) t1 += '#';
else{
t1 += '.';
}
if(b1[i] == '.' && (b1[i - 1] == '#' || b1[i + 1] == '#')) 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: 0
Wrong Answer
time: 1ms
memory: 5672kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
YES #..# .##. ...# #.#. .#.. #..# .##. YES ##.#. ..#.# ...#. #.#.# .#... #.#.. .#.## NO YES .######.######.####.#.##### #......#......#....#.#..... .#......................... #.######################### .#......................... #....#.#....##.#.....#..... .####...####..#.......##### YES ########...
result:
wrong answer Testcase 4: Connected condition failed.