QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#795635 | #9621. 连方 | 1903331632 | WA | 1ms | 3876kb | C++23 | 2.3kb | 2024-11-30 22:25:37 | 2024-11-30 22:25:38 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define all(s) s.begin(), s.end()
#define int long long
#define endl '\n'
const int N = 1e6 + 10;
const int mod = 1e9 + 7;
void solve()
{
int n;
cin >> n;
vector<string> mp(8, string(n + 10, '.'));
bool is1 = false, is2 = false;
for (int i = 1; i <= n; i++)
{
cin >> mp[1][i];
if (mp[1][i] == '.')
is1 = true;
}
for (int i = 1; i <= n; i++)
{
cin >> mp[7][i];
if (mp[7][i] == '.')
is2 = true;
}
if (!is1 && !is2)
{
cout << "Yes" << endl;
for (int i = 1; i <= n; i++)
cout << mp[1] << endl;
return;
}
if (!is1 || !is2)
{
cout << "No" << endl;
return;
}
for (int i = 1; i <= n; i++)
{
if (mp[1][i] == '.')
mp[2][i] = '#';
else
mp[2][i] = '.';
}
for (int i = 1; i <= n; i++)
{
if (mp[7][i] == '.')
mp[6][i] = '#';
else
mp[6][i] = '.';
}
int l, r;
for (int i = 1; i <= n; i++)
{
if (mp[2][i] == '.' && ((i - 1 >= 1 && mp[2][i - 1] == '#') || (mp[2][i + 1] == '#' && i + 1 <= n)))
{
l = i;
break;
}
}
for (int i = 1; i <= n; i++)
{
if (mp[6][i] == '.' && ((i - 1 >= 1 && mp[6][i - 1] == '#') || (mp[6][i + 1] == '#' && i + 1 <= n)))
{
r = i;
break;
}
}
if (l == r)
{
for (int i = 3; i <= 5; i++)
{
mp[i][l] = '#';
}
}
else if (abs(l - r) == 1)
{
mp[3][l] = '#';
mp[4][l] = '#';
mp[5][r] = '#';
}
else
{
mp[3][l] = '#';
mp[5][r] = '#';
if (l > r)
swap(l, r);
for (int i = l + 1; i <= r - 1; i++)
{
mp[4][i] = '#';
}
}
cout << "Yes" << endl;
for (int i = 1; i <= 7; i++)
{
for (int j = 1; j <= n; j++)
{
cout << mp[i][j];
}
cout << endl;
}
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
int t;
cin >> t;
while (t--)
solve();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3876kb
input:
5 4 #..# .##. 5 ##.#. .#.## 6 ###### .####. 27 .######.######.####.#.##### .####...####..#.......##### 10 ########## ##########
output:
Yes #..# .##. #... #... .#.. #..# .##. Yes ##.#. ..#.# .#... .#... .#... #.#.. .#.## No Yes .######.######.####.#.##### #......#......#....#.#..... .#......................... .#......................... .#......................... #....###....##.#######..... .####...####..#.......##### Yes .#######...
result:
wrong answer Testcase 5: incorrect matrix size.