QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#728794 | #9576. Ordainer of Inexorable Judgment | ucup-team3510# | WA | 1ms | 4268kb | C++14 | 1.8kb | 2024-11-09 15:56:32 | 2024-11-09 15:56:34 |
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-09 15:56:32]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
typedef long double ld;
const ld pi = acosl(-1), eps = 1e-9;
struct vec
{
ld x, y;
vec(ld x0 = 0, ld y0 = 0)
{
x = x0;
y = y0;
}
vec operator + (vec v)
{
return vec(x + v.x, y + v.y);
}
vec operator - (vec v)
{
return vec(x - v.x, y - v.y);
}
vec operator * (ld k)
{
return vec(x * k, y * k);
}
ld dis2()
{
return x * x + y * y;
}
void print()
{
printf("(%.10Lf, %.10Lf)\n", x, y);
}
};
vec p[105];
pair<vec, vec> haha(vec a, ld b, vec c, ld d) // b, d is dis^2
{
c = c - a;
ld p = (c.dis2() - d + b) / 2, x, y, u, v, w;
ld x0, x1;
if(abs(c.y) < eps)
{
x = p / c.x;
y = sqrtl(b - x * x);
return make_pair(a + vec(x, y), a + vec(x, -y));
}
u = c.dis2();
v = -2 * p * c.x;
w = p * p - b * c.y * c.y;
x0 = (-v + sqrtl(v * v - 4 * u * w)) / (2 * u);
x1 = (-v - sqrtl(v * v - 4 * u * w)) / (2 * u);
return make_pair(a + vec(x0, (p - c.x * x0) / c.y), a + vec(x1, (p - c.x * x1) / c.y));
}
int main()
{
int n, x0, y0, d, t, i;
vec u, v;
ld l, r, L, R, pl, pr, ans = 0;
L = 2 * pi;
R = 0;
scanf("%d%d%d%d%d", &n, &x0, &y0, &d, &t);
pl = atan2(y0, x0);
for(i = 1; i <= n; i++)
{
scanf("%Lf%Lf", &p[i].x, &p[i].y);
u = (vec(0, 0) + p[i]) * 0.5;
auto o = haha(vec(0, 0), (ld)d * d, u, u.dis2());
u = o.first;
v = o.second;
// printf("#%d\n", i);
// u.print();
// v.print();
if(u.x * v.y < u.y * v.x)
swap(u, v);
l = atan2(v.y, v.x) - pi / 2;
r = atan2(u.y, u.x) + pi / 2;
// printf("#%.10Lf %.10Lf\n", l, r);
L = min(L, l);
R = max(R, r);
}
pr = pl + t;
for(i = 0; i < 10000; i++)
if(max(L + i * 2 * pi, pl) < min(R + i * 2 * pi, pr))
ans += min(R + i * 2 * pi, pr) - max(L + i * 2 * pi, pl);
printf("%.10Lf\n", ans);
return 0;
}
/*
3 1 0 1 1
1 2
2 1
2 2
*/
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 3916kb
input:
3 1 0 1 1 1 2 2 1 2 2
output:
1.0000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4016kb
input:
3 1 0 1 2 1 2 2 1 2 2
output:
1.5707963268
result:
ok found '1.5707963', expected '1.5707963', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 4036kb
input:
3 1 0 1 10000 1 2 2 1 2 2
output:
2500.7077522575
result:
ok found '2500.7077523', expected '2500.7077523', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4240kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.3842413003
result:
ok found '0.3842413', expected '0.3842413', error '0.0000000'
Test #5:
score: -100
Wrong Answer
time: 0ms
memory: 4268kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
12499.2960638859
result:
wrong answer 1st numbers differ - expected: '2500.2406700', found: '12499.2960639', error = '3.9992372'