QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#859328#9668. Isoball: 2D VersionyjtacWA 0ms4224kbC++204.2kb2025-01-17 17:24:342025-01-17 17:24:34

Judging History

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

  • [2025-01-17 17:24:34]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:4224kb
  • [2025-01-17 17:24:34]
  • 提交

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;
}

详细

Test #1:

score: 0
Wrong Answer
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:

0
0.333333
-0.333333
0.2
-0.2
Yes
0
0.333333
0.333333
0.2
0.2
No
1
1
1
1
1
Yes
1
1
1
1
1
No
-1
-1
1
1
-1
Yes

result:

wrong answer 1st lines differ - expected: 'Yes', found: '0'