QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#863088#9668. Isoball: 2D VersionAlinteckQRWA 0ms3840kbC++262.9kb2025-01-19 13:01:142025-01-19 13:01:16

Judging History

This is the latest submission verdict.

  • [2025-01-19 13:01:16]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3840kb
  • [2025-01-19 13:01:14]
  • Submitted

answer

#include <iostream>
#include <math.h>
#include <numbers>

using namespace std;

long double PI = std::numbers::pi;

long int    n;
long double xo, yo, r, vx, vy, ix1, iy1, ix2, iy2;

long double trans(long double dx1, long double dy1, long double dx2, long double dy2)
{
    long double res = atan2(dy2 - dy1, dx2 - dx1);
    if (res < 0)
    {
        res += 2 * PI;
    }
    return res;
}

int main()
{
    cin >> n;
    while (n--)
    {
        cin >> xo >> yo >> r >> vx >> vy >> ix1 >> iy1 >> ix2 >> iy2;
        if (ix2 - ix1 < 2 * r || iy2 - iy1 < 2 * r)
        {
            cout << "No" << endl;
            continue;
        }
        long double nx1 = ix1 + r;
        long double ny1 = iy1 + r;
        long double nx2 = ix2 - r;
        long double ny2 = iy2 - r;

        if (nx1 <= xo && xo <= nx2 && ny1 <= yo && yo <= ny2)
        {
            cout << "Yes" << endl;
            continue;
        }

        if (vx != 0 && vy != 0)
        {
            if ((ny1 <= yo + ((nx1 - xo) * vy / vx) && yo + ((nx1 - xo) * vy / vx) <= ny2) || (ny1 <= yo + ((nx2 - xo) * vy / vx) && yo + ((nx2 - xo) * vy / vx) <= ny2))
            {
                if (((nx1 - xo) * vx > 0 || (nx2 - xo) * vx > 0) && ((ny1 - yo) * vy > 0 || (ny2 - yo) * vy > 0))
                {
                    cout << "Yes" << endl;
                }
                else
                {
                    cout << "No" << endl;
                }
            }
            else
            {
                cout << "No" << endl;
            }
        }
        else if (vx != 0)
        {
            if (xo < nx1)
            {
                if (vx > 0)
                {
                    cout << "Yes" << endl;
                }
                else
                {
                    cout << "No" << endl;
                }
            }
            else if (xo > nx2)
            {
                if (vx < 0)
                {
                    cout << "Yes" << endl;
                }
                else
                {
                    cout << "No" << endl;
                }
            }
            else
            {
                cout << "Yes" << endl;
            }
        }
        else if (vy != 0)
        {
            if (yo < ny1)
            {
                if (vy > 0)
                {
                    cout << "Yes" << endl;
                }
                else
                {
                    cout << "No" << endl;
                }
            }
            else if (yo > ny2)
            {
                if (vy < 0)
                {
                    cout << "Yes" << endl;
                }
                else
                {
                    cout << "No" << endl;
                }
            }
            else
            {
                cout << "Yes" << endl;
            }
        }
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3840kb

input:

5
0 0 1 1 0
2 -2 6 2
0 0 1 1 0
2 0 6 2
0 0 1 1 1
1 1 3 3
0 0 1 -1 -1
1 1 3 3
0 0 1 -1 1
-5 -5 5 5

output:

Yes
Yes
Yes
No
Yes

result:

wrong answer 2nd lines differ - expected: 'No', found: 'Yes'