QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#789573 | #9621. 连方 | Hojstyer# | WA | 0ms | 3616kb | C++20 | 3.0kb | 2024-11-27 20:56:27 | 2024-11-27 20:56:27 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
void solve()
{
int n;
cin >> n;
string a, b;
cin >> a >> b;
int cnt = 0;
for (int i = 1; i <= n; ++i)
cnt += (a[i] == '#');
if (a == b && cnt == n)
{
cout << "Yes\n";
for (int i = 0; i < 7; ++i)
cout << a << '\n';
return;
}
else
{
int p1 = -1, p2 = -1;
for (int i = 0; i < n; ++i)
{
if (a[i] == '.')
p1 = i;
if (b[i] == '.')
p2 = i;
}
if (p1 == -1 || p2 == -1)
cout << "No\n";
else
{
cout << "Yes\n";
cout << a << "\n";
string res;
for (int i = 0; i < n; ++i)
if (a[i] == '.')
res += '#';
else
res += '.';
cout << res << '\n';
res.clear();
for (int i = 1; i < n; ++i)
{
if (a[i] == '#' && a[i - 1] == '.')
p1 = i;
if (b[i] == '#' && b[i - 1] == '.')
p2 = i;
}
for (int i = 0; i < n - 1; ++i)
{
if (a[i] == '#' && a[i + 1] == '.')
p1 = i;
if (b[i] == '#' && b[i + 1] == '.')
p2 = i;
}
for (int i = 0; i < n; ++i)
if (p1 == i)
res += '#';
else
res += '.';
cout << res << '\n';
res.clear();
if (abs(p1 - p2) <= 1)
{
for (int i = 0; i < n; ++i)
if (p1 == i)
res += '#';
else
res += '.';
cout << res << '\n';
res.clear();
}
else
{
for (int i = 0; i <= min(p1, p2); ++i)
res += '.';
for (int i = min(p1, p2) + 1; i <= max(p1, p2) - 1; ++i)
res += '#';
for (int i = max(p1, p2); i < n; ++i)
res += '.';
cout << res << "\n";
res.clear();
}
for (int i = 0; i < n; ++i)
if (p2 == i)
res += '#';
else
res += '.';
cout << res << '\n';
res.clear();
for (int i = 0; i < n; ++i)
if (b[i] == '.')
res += '#';
else
res += '.';
cout << res << '\n';
res.clear();
cout << b << "\n";
}
}
}
int main()
{
ios::sync_with_stdio(false);
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: 0ms
memory: 3616kb
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.