QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#732920 | #9576. Ordainer of Inexorable Judgment | KXDdesu | WA | 0ms | 4408kb | C++23 | 2.7kb | 2024-11-10 16:27:45 | 2024-11-10 16:27:46 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-14 21:58:28]
- hack成功,自动添加数据
- (/hack/1181)
- [2024-11-10 16:27:45]
- 提交
answer
#include<bits/stdc++.h>
#define int long long
#define all(x) (x).begin(), (x).end()
#define fi first
#define se second
#define lowbit(x) ((x) & (-x))
using i64 = long long;
using pii = std::pair<int, int>;
using namespace std;
const double PI = acos(-1);
const double eps = 1e-8;
struct point
{
double x, y;
};
double sign(double a)
{
if(fabs(a) < eps)
return 0;
if(a < 0)
return -1;
return 1;
}
point operator- (point a, point b)
{
return {a.x - b.x, a.y - b.y};
}
point rotate(point a, double b)
{
return {a.x * cos(b) + a.y * sin(b), -a.x * sin(b) + a.y * cos(b)};
}
double cross(point a, point b)
{
return a.x * b.y - a.y * b.x;
}
double get_dist(point a, point b)
{
double dx = a.x - b.x;
double dy = a.y - b.y;
return sqrt(dx * dx + dy * dy);
}
void solve()
{
point O = {0, 0};
double n, d, t;
point v0;
cin >> n >> v0.x >> v0.y >> d >> t;
vector<point> a(n + 1);
for(int i = 1; i <= n; i ++)
{
int x, y;
cin >> x >> y;
a[i] = (point){x, y};
}
vector<point> v1(n + 1), v2(n + 1);
for(int i = 1; i <= n; i ++)
{
double dist = get_dist(O, a[i]);
double angle = asin(d / dist);
v1[i] = rotate((a[i] - O), angle);
v2[i] = rotate((a[i] - O), -angle);
}
bool flag1 = false, flag2 = false, flag3 = false, flag4 = false;
for(int i = 1; i <= n; i ++)
{
if(sign(cross(v1[i], {1, 0})) < 0)
flag1 = true;
else if(sign(cross(v1[i], {1, 0})) > 0)
flag2 = true;
if(sign(cross(v2[i], {1, 0})) < 0)
flag3 = true;
else if(sign(cross(v2[i], {1, 0})) > 0)
flag4 = true;
}
double mi1 = 1e9, ma1 = -1e9, mi2 = 1e9, ma2 = -1e9;
for(int i = 1; i <= n; i ++)
{
double angle1 = atan2(v1[i].y, v1[i].x);
mi1 = min(mi1, angle1);
ma1 = max(ma1, angle1);
double angle2 = atan2(v2[i].y, v2[i].x);
mi2 = min(mi2, angle2);
ma2 = max(ma2, angle2);
}
if(flag1 && flag2)
{
mi1 += PI * 2;
ma1 += PI * 2;
}
if(flag3 && flag4)
{
mi2 += PI * 2;
ma2 += PI * 2;
}
double st_angle = mi1, ed_angle = ma2;
int cnt = t / (PI * 2);
t -= cnt * PI * 2;
double v0_angle = atan2(v0.y, v0.x);
if(v0_angle < 0)
v0_angle += PI * 2;
double v1_angle = v0_angle + t;
double ans = max(0.0, min(ed_angle, v1_angle) - max(st_angle, v0_angle)) + cnt * (ed_angle - st_angle);
printf("%.7lf\n", ans);
}
signed main()
{
int T = 1;
while (T --) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 4288kb
input:
3 1 0 1 1 1 2 2 1 2 2
output:
1.0000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4268kb
input:
3 1 0 1 2 1 2 2 1 2 2
output:
1.5707963
result:
ok found '1.5707963', expected '1.5707963', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 4284kb
input:
3 1 0 1 10000 1 2 2 1 2 2
output:
2500.7077523
result:
ok found '2500.7077523', expected '2500.7077523', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4408kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.3842413
result:
ok found '0.3842413', expected '0.3842413', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 4372kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
-7497.0926519
result:
wrong answer 1st numbers differ - expected: '2500.2406700', found: '-7497.0926519', error = '3.9985484'