QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#863039#9668. Isoball: 2D VersionAlinteckQRWA 1ms3840kbC++202.8kb2025-01-19 12:10:122025-01-19 12:10:13

Judging History

This is the latest submission verdict.

  • [2025-01-19 12:10:13]
  • Judged
  • Verdict: WA
  • Time: 1ms
  • Memory: 3840kb
  • [2025-01-19 12:10:12]
  • 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;

        long double xt, yt;

        xt = xo + 1000000 * vx;
        yt = yo + 1000000 * vy;

        long double dt  = trans(xo, yo, xt, yt);
        long double d11 = trans(xo, yo, nx1, ny1);
        long double d12 = trans(xo, yo, nx1, ny2);
        long double d21 = trans(xo, yo, nx2, ny1);
        long double d22 = trans(xo, yo, nx2, ny2);
        /*cout << dt / PI << endl;
        cout << d11 / PI << endl;
        cout << d12 / PI << endl;
        cout << d21 / PI << endl;
        cout << d22 / PI << endl;*/

        if (ny1 <= yo && yo <= ny2)
        {
            // cout << "?" << endl;
            if (xo < nx1)
            {
                if ((d11 <= dt && d11 <= 2) || (dt <= d12 && dt >= 0))
                {
                    cout << "Yes" << endl;
                }
                else
                {
                    cout << "No" << endl;
                }
            }
            else if (nx2 < xo)
            {
                if (dt <= d11 && dt >= d12)
                {
                    cout << "Yes" << endl;
                }
                else
                {
                    cout << "No" << endl;
                }
            }
            else
            {
                cout <<"????"<<endl;
                cout << "Yes" << endl;
            }
        }
        else if (yo < ny1)
        {
            // cout<<"?"<<endl;
            if (max(max(d11, d22), max(d12, d21)) >= dt && min(min(d11, d22), min(d12, d21)) <= dt)
            {
                cout << "Yes" << endl;
            }
            else
            {
                cout << "No" << endl;
            }
        }
        else if (yo > ny2)
        {
            // cout<<"? "<<endl;
            if (max(max(d11, d22), max(d12, d21)) >= dt && min(min(d11, d22), min(d12, d21)) <= dt)
            {
                cout << "Yes" << endl;
            }
            else
            {
                cout << "No" << endl;
            }
        }
    }
    return 0;
}

详细

Test #1:

score: 0
Wrong Answer
time: 1ms
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
No
Yes
No
????
Yes

result:

wrong answer 5th lines differ - expected: 'Yes', found: '????'