QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#863089 | #9668. Isoball: 2D Version | AlinteckQR | WA | 22ms | 3840kb | C++26 | 3.2kb | 2025-01-19 13:04:26 | 2025-01-19 13:04:27 |
Judging History
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 (yo < ny1 || ny2 < yo)
{
cout << "No" << endl;
continue;
}
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 (xo < nx1 || nx2 < xo)
{
cout << "No" << endl;
continue;
}
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: 100
Accepted
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 No Yes
result:
ok 5 lines
Test #2:
score: 0
Accepted
time: 0ms
memory: 3712kb
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: 22ms
memory: 3840kb
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 No 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 No No No Yes Yes No No Yes Yes No No No No No No No No No No No No No No No No No No No No No No No No No No No No No No Yes N...
result:
wrong answer 14th lines differ - expected: 'Yes', found: 'No'