QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#863003 | #9668. Isoball: 2D Version | AlinteckQR | WA | 20ms | 4096kb | C++20 | 3.4kb | 2025-01-19 11:37:40 | 2025-01-19 11:37:52 |
Judging History
answer
#include <iostream>
#include <math.h>
#include <numbers>
using namespace std;
long double PI = std::numbers::pi;
long int n;
double xo, yo, r, vx, vy, ix1, iy1, ix2, iy2;
double trans(double dx1, double dy1, double dx2, double dy2)
{
// double tana = (dy2 - dy1) / (dx2 - dx1);
return atan2(dy2 - dy1, dx2 - dx1);
/*if (dy2 - dy1 == 0 || dx2 - dx1 == 0)
{
while(0);
}*/
/*if (dx2 - dx1 >= 0 && dy2 - dy1 >= 0)
{
return atan2(dy2 - dy1,dx2 - dx1);
}
else if (dx2 - dx1 < 0 && dy2 - dy1 <= 0)
{
return PI + atan2(dy2 - dy1,dx2 - dx1)
}
else if (dx2 - dx1 <= 0 && dy2 - dy1 >= 0)
{
// cout << "?" <<endl;
return PI + atan2(dy2 - dy1,dx2 - dx1);
}
else if (dx2 - dx1 >= 0 && dy2 - dy1 <= 0)
{
return 2 * PI + atan2(dy2 - dy1,dx2 - dx1);
}
return atan2(tana);*/
}
double tk(double tx1, double ty1, double tx2, double ty2)
{
return (ty2 - ty1) / (tx2 - tx1);
}
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;
}
double nx1 = ix1 + r;
double ny1 = iy1 + r;
double nx2 = ix2 - r;
double ny2 = iy2 - r;
double L = pow(vx * vx + vy * vy, 0.5);
double xt = xo + 3000000 * vx / L;
double yt = yo + 3000000 * vy / L;
// cout <<xt<<" " <<yt<<endl;
double dt = trans(xo, yo, xt, yt);
double d11 = trans(xo, yo, nx1, ny1);
double d12 = trans(xo, yo, nx1, ny2);
double d21 = trans(xo, yo, nx2, ny1);
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 << "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: 100
Accepted
time: 0ms
memory: 4096kb
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: 20ms
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 No No No No No No No No No No No No No No Yes No No Yes No No No No No No No No No No No No Yes No No Yes No No No Yes No Yes 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 Ye...
result:
wrong answer 19th lines differ - expected: 'Yes', found: 'No'