QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789573#9621. 连方Hojstyer#WA 0ms3616kbC++203.0kb2024-11-27 20:56:272024-11-27 20:56:27

Judging History

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

  • [2024-11-27 20:56:27]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-11-27 20:56:27]
  • 提交

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.