QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#863059#9668. Isoball: 2D VersionAlinteckQRWA 1ms3712kbC++261.8kb2025-01-19 12:28:322025-01-19 12:28:32

Judging History

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

  • [2025-01-19 12:28:32]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3712kb
  • [2025-01-19 12:28:32]
  • 提交

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 (vx != 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))
            {
                cout << "Yes" << endl;
            }
            else
            {
                cout << "No" << endl;
            }
        }
        else
        {
            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;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3712kb

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
Yes
Yes

result:

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