QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#795635#9621. 连方1903331632WA 1ms3876kbC++232.3kb2024-11-30 22:25:372024-11-30 22:25:38

Judging History

你现在查看的是最新测评结果

  • [2024-11-30 22:25:38]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3876kb
  • [2024-11-30 22:25:37]
  • 提交

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();
}

Details

Tip: Click on the bar to expand more detailed information

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.