QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#757153 | #9576. Ordainer of Inexorable Judgment | Bicycle_23 | WA | 0ms | 4240kb | C++23 | 2.0kb | 2024-11-17 01:06:35 | 2024-11-17 01:06:37 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-17 01:06:35]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
// #define endl '\n'
constexpr int maxn = 2e5 + 5;
constexpr double pi = acos(-1);
double f(double x, double y)
{
double res = 0;
if (x == 0)
{
if (y > 0) res = pi / 2;
else res = pi * 3 / 2;
}
else
{
res = atan(y / x);
// cout << x << " " << y << " " << y / x << " " << res << endl;
if (y < 0 || (y == 0 && x < 0)) res += pi / 2;
}
return res;
}
void solve()
{
int n, x0, y0, d, t;
cin >> n >> x0 >> y0 >> d >> t;
vector<int> x(n + 1, 0), y(n + 1, 0);
for (int i = 1; i <= n; i++) cin >> x[i] >> y[i];
double avex = 0, avey = 0;
for (int i = 1; i <= n; i++) avex += x[i], avey += y[i];
avex /= n; avey /= n;
double st = f(avex, avey);
st += pi;
if (st >= 2 * pi) st -= 2 * pi;
if (st != 0) st = st - 2 * pi;
vector<double> mx(n + 1, 0), mn(n + 1, 0);
for (int i = 1; i <= n; i++)
{
double dir = f(x[i], y[i]) - st;
if (dir >= 2 * pi) dir -= 2 * pi;
double seita = asin(d / sqrt(x[i] * x[i] + y[i] * y[i]));
mx[i] = dir + seita;
mn[i] = dir - seita;
}
double smx = mx[1], smn = mn[1];
for (int i = 2; i <= n; i++) smx = max(smx, mx[i]), smn = min(smn, mn[i]);
double dir = f(x0, y0) - st;
if (dir >= 2 * pi) dir -= 2 * pi;
int T = t / (2 * pi);
t -= T * 2 * pi;
double ans = T * (smx - smn);
double l, r;
if (dir + t >= 2 * pi)
{
l = max(dir, smn);
r = min(2 * pi, smx);
ans += max(0.0, r - l);
l = smn;
r = min(smx, dir + t - 2 * pi);
ans += max(0.0, r - l);
}
else
{
r = min(dir + t, smx);
l = max(dir, smn);
ans += max(0.0, r - l);
}
printf("%.12lf", ans);
}
signed main()
{
cin.tie(0); cout.tie(0);
ios::sync_with_stdio(0);
int _ = 1;
// cin >> _;
while (_--) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4240kb
input:
3 1 0 1 1 1 2 2 1 2 2
output:
1.000000000000
result:
ok found '1.0000000', expected '1.0000000', error '0.0000000'
Test #2:
score: 0
Accepted
time: 0ms
memory: 4200kb
input:
3 1 0 1 2 1 2 2 1 2 2
output:
1.570796326795
result:
ok found '1.5707963', expected '1.5707963', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 4124kb
input:
3 1 0 1 10000 1 2 2 1 2 2
output:
2500.707752257475
result:
ok found '2500.7077523', expected '2500.7077523', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 4128kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
0.384241300290
result:
ok found '0.3842413', expected '0.3842413', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 4088kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
2500.240670009608
result:
ok found '2500.2406700', expected '2500.2406700', error '0.0000000'
Test #6:
score: -100
Wrong Answer
time: 0ms
memory: 4152kb
input:
4 1 0 1 10000 -2 3400 -4 10000 -4 -10000 -2 -3400
output:
7499.474985506565
result:
wrong answer 1st numbers differ - expected: '4999.2191154', found: '7499.4749855', error = '0.5001293'