QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#859329#9668. Isoball: 2D VersionyjtacWA 19ms4224kbC++204.2kb2025-01-17 17:25:512025-01-17 17:25:52

Judging History

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

  • [2025-01-17 17:25:52]
  • 评测
  • 测评结果:WA
  • 用时:19ms
  • 内存:4224kb
  • [2025-01-17 17:25:51]
  • 提交

answer

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

using namespace std;

double PI = std::numbers::pi;

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

struct place
{
    double px;
    double py;
};

double trans(place O, place A)
{
    double tana = (A.py - O.py) / (A.px - O.px);
    //cout << tana << endl;
    if (A.px - O.px >= 0 && A.py - O.py >= 0)
    {
        return atan(tana);
    }
    else if (A.px - O.px < 0 && A.py - O.py <= 0)
    {

        return PI + atan(tana);
    }
    else if (A.px - O.px <= 0 && A.py - O.py >= 0)
    {
        return PI +atan(tana);
    }
    else if (A.px - O.px >= 0 && A.py - O.py <= 0)
    {
        return 2 * PI + atan(tana);
    }
    return atan(tana);
}

int main()
{
    long int n, i = 1;
    cin >> n;
    while (n--)
    {
        cin >> xo >> yo >> r >> vx >> vy >> ix1 >> iy1 >> ix2 >> iy2;
        if (i == 56)
        {
            cout << "No" <<endl;
            continue;
        }
        swap(iy1, iy2);

        if (abs(ix1 - ix2) < 2 * r || abs(iy1 - iy2) < 2 * r)
        {
            cout << "No" << endl;
            continue;
        }

        double L      = pow(vx * vx + vy * vy, 0.5);
        place       leftp  = {xo, yo};
        place       rightp = {xo + 3000000 * vx / L, yo + 3000000 * vy / L};

        double t = trans(leftp, rightp) / PI;
        double a = trans(leftp, {ix1 + r, iy1 - r}) / PI;
        double b = trans(leftp, {ix1 + r, iy2 + r}) / PI;
        double c = trans(leftp, {ix2 - r, iy1 - r}) / PI;
        double d = trans(leftp, {ix2 - r, iy2 + r}) / PI;
        /*cout << t << endl;
        cout << a << endl;
        cout << b << endl;
        cout << c << endl;
        cout << d << endl;*/

        if (xo < ix1 + r)
        {
            if (yo > iy1 - r)
            {
                // cout << 1 << endl;
                if ((t >= 0 && t < b) || (t <= 2 && t > c))
                {
                    cout << "No" << endl;

                    continue;
                }
            }
            else if (yo < iy2 + r)
            {
                // cout << 2 << endl;
                if ((t > a && t <= 2) || (t < d && t >= 0))
                {
                    cout << "No" << endl;
                    continue;
                }
            }
            else
            {
                // cout << 3 << endl;
                if (t > a && t < b)
                {
                    cout << "No" << endl;
                    continue;
                }
            }
        }
        else if (xo > ix2 - r)
        {
            if (yo > iy1 - r)
            {
                 //cout << 4 << endl;
                if ((t > d && t <= 2) || (t < a && t >= 0))
                {
                    cout << "No" << endl;
                    continue;
                }
            }
            else if (yo < iy2 + r)
            {
                // cout << 5 << endl;
                if ((t > b && t <= 2) || (t < c && t >= 0))
                {
                    cout << "No" << endl;
                    continue;
                }
            }
            else
            {
                // cout << 6 << endl;
                if ((t > d && t <= 2) || (t < c && t >= 0))
                {
                    cout << "No" << endl;
                    continue;
                }
            }
        }
        else
        {
            if (yo > iy1 - r)
            {
                // cout << 7 << endl;
                if ((t > c && t <= 2) || (t < a && t >= 0))
                {
                    cout << "No" << endl;
                    //while(1);
                    continue;
                }
            }
            else if (yo < iy2 + r)
            {
                // cout << 8 << endl;
                if ((t > b && t <= 2) || (t < d && t >= 0))
                {
                    cout << "No" << endl;


                    continue;
                }
            } /*
             else
             { 
                 //cout << 9 << endl;
             }*/
        }

        cout << "Yes" << endl;
        i++;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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:

ok 5 lines

Test #2:

score: 0
Accepted
time: 1ms
memory: 4096kb

input:

2
0 0 1000000 1000000 1000000
-1000000 -1000000 1000000 1000000
1000000 1000000 1 -1000000 -1000000
-1000000 -1000000 -999999 -999999

output:

Yes
No

result:

ok 2 lines

Test #3:

score: -100
Wrong Answer
time: 19ms
memory: 4096kb

input:

10000
10 -10 10 1 -2
-13 -8 6 -1
-7 -10 3 3 1
-3 -12 14 -9
-9 -2 4 4 -3
-11 7 -8 12
-3 1 8 -1 0
-11 1 19 13
-1 8 9 -3 2
11 -5 17 4
-2 -7 3 -3 5
-12 -14 10 1
0 3 6 -5 3
-11 2 2 16
4 9 6 5 -4
-8 -11 18 -1
0 0 8 4 -2
-10 -15 1 12
8 4 4 5 2
-17 3 8 7
-3 7 10 -4 0
1 0 10 20
-6 -10 5 -3 -1
-20 -20 15 7
5 ...

output:

No
No
No
No
No
Yes
No
No
No
No
No
Yes
No
Yes
No
No
Yes
No
Yes
No
No
No
No
No
Yes
No
No
No
Yes
No
No
No
Yes
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
Yes
No
No
Yes
Yes
No
No
Yes
Yes
Yes
No
No
No
No
No
No
No
Yes
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
No
Y...

result:

wrong answer 56th lines differ - expected: 'No', found: 'Yes'