QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#626071#6677. Puzzle: SashiganeBulonteWA 0ms3636kbC++202.5kb2024-10-09 22:57:402024-10-09 22:57:41

Judging History

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

  • [2024-10-09 22:57:41]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3636kb
  • [2024-10-09 22:57:40]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;

struct NODE
{
    int r, c, h, w;
};

vector<NODE> ans;

void solve()
{
    int n, x, y;
    cin >> n >> x >> y;
    ans.clear();
    int len = 0;
    int MAX = min(x, y), MIN = min(x, y);
    for (int i = 1; x + i <= n && y + i <= n; i++)
    {
        int r = x + i, c = y + i;
        len++;
        // cout << r << " " << c << " " << -len << " " << -len << endl;
        ans.push_back({r, c, -len, -len});
        if (x + i == n || y + i == n)
        {
            if (x + i == n && y + i != n)
            {
                MAX = y + i;
            }
            else if (x + i != n && y + i == n)
            {
                MAX = x + i;
            }
            else
            {
                MAX = -1;
            }
        }
    }

    for (int j = 1; x - j >= 1 && y - j >= 1; j++)
    {
        int r = x - j, c = y - j;
        len++;
        // cout << r << " " << c << " " << len << " " << len << endl;
        ans.push_back({r, c, len, len});
        if (x - j == 1 || y - j == 1)
        {
            if (x - j == 1 && y - j != 1)
            {
                MIN = y - j;
            }
            else if (x - j != 1 && y - j == 1)
            {
                MIN = x - j;
            }
            else
            {
                MIN = -1;
            }
        }
    }

    if (MAX > 0 && MIN > 0)
    {
        for (int i = 1; MAX + i <= n && MIN - i >= 1; i++)
        {
            int r = MAX + i, c = MIN - i;
            len++;
            // cout << r << " " << c << " ";
            if (r > x && c > y)
            {
                // cout << -len << " " << -len << endl;
                ans.push_back({r, c, -len, -len});
            }
            else if (r > x && c < y)
            {
                // cout << -len << " " << len << endl;
                ans.push_back({r, c, -len, len});
            }
            else if (r < x && c > y)
            {
                // cout << len << " " << -len << endl;
                ans.push_back({r, c, len, -len});
            }
            else
            {
                //cout << len << " " << len << endl;
                ans.push_back({r, c, len, len});
            }
        }
    }

    cout << "Yes" << endl;
    cout << ans.size() << endl;
    for (int i = 0; i < ans.size(); i++)
    {
        cout << ans[i].r << " " << ans[i].c << " " << ans[i].h << " " << ans[i].w << endl;
    }
}

int main()
{
    solve();
    return 0;
}

详细

Test #1:

score: 100
Accepted
time: 0ms
memory: 3636kb

input:

5 3 4

output:

Yes
4
4 5 -1 -1
2 3 2 2
1 2 3 3
5 1 -4 4

result:

ok Correct. (1 test case)

Test #2:

score: 0
Accepted
time: 0ms
memory: 3612kb

input:

1 1 1

output:

Yes
0

result:

ok Correct. (1 test case)

Test #3:

score: 0
Accepted
time: 0ms
memory: 3564kb

input:

3 2 3

output:

Yes
2
1 2 1 1
3 1 -2 2

result:

ok Correct. (1 test case)

Test #4:

score: -100
Wrong Answer
time: 0ms
memory: 3632kb

input:

10 10 5

output:

Yes
9
9 4 1 1
8 3 2 2
7 2 3 3
6 1 4 4
6 5 5 5
7 4 6 6
8 3 7 7
9 2 8 8
10 1 9 9

result:

wrong answer L shape #5 out of bounds. (test case 1)