QOJ.ac
QOJ
ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#1181 | #722267 | #9576. Ordainer of Inexorable Judgment | LogSingleDog | ucup-team3519 | Success! | 2024-11-14 21:58:15 | 2024-11-14 21:58:16 |
Details
Extra Test:
Wrong Answer
time: 0ms
memory: 3864kb
input:
3 -3 4 1 4 3 -1 5 -5 2 5
output:
0.000000000000
result:
wrong answer 1st numbers differ - expected: '0.8584073', found: '0.0000000', error = '0.8584073'
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#722267 | #9576. Ordainer of Inexorable Judgment | ucup-team3519# | WA | 1ms | 3968kb | C++17 | 2.0kb | 2024-11-07 18:23:32 | 2024-11-14 21:59:07 |
answer
#include <bits/stdc++.h>
using real = long double;
using i64 = int64_t;
i64 sqr(i64 x) {
return x * x;
}
const real PI = std::acos(static_cast<real>(-1));
const real EPS = 1e-8;
real angle(real x, real y) {
return std::atan2(y, x);
}
real reduce(real x) {
while (x >= PI * 2) x -= PI * 2;
while (x < 0) x += PI * 2;
return x;
}
real inter(real l, real r, real u, real v) {
if (r < u || l > v) return 0;
return std::min(r, v) - std::max(l, u);
}
struct Point {
int x, y;
};
int main() {
int n, x0, y0, d;
real t;
std::cin >> n >> x0 >> y0 >> d >> t;
std::vector<Point> p(n);
for (auto &[x, y] : p) std::cin >> x >> y;
// for (int i = 0; i < n; ++i) {
// auto a = p[i], b = p[(i + 1) % n];
// i64 up = sqr(a.x * b.y - a.y * b.x), down = sqr(a.x - b.x) + sqr(a.y - b.y);
// // up/down <= d*d
// if (up <= down * d * d) {
// std::cout << t << '\n';
// return 0;
// }
// }
std::vector<real> v;
for (int i = 0; i < n; ++i) {
auto [x, y] = p[i];
real theta = angle(std::sqrt(real(x * x + y * y - d * d)), d);
real base = angle(x, y);
v.push_back(reduce(base - theta));
v.push_back(reduce(base + theta));
}
std::sort(v.begin(), v.end());
real S = 0, T = 0;
int cnt = 0;
for (int i = 0; i < v.size(); ++i) {
real s = v[(i + 1) % v.size()], t = v[i];
real range = reduce(t - s);
if (range <= PI + EPS) {
S = s, T = t;
++cnt;
}
}
real B = angle(x0, y0);
S = reduce(S - B);
T = reduce(T - B);
real C = reduce(T - S);
real ans = 0;
while (t >= PI * 2) {
t -= PI * 2;
ans += C;
}
if (S <= T) {
ans += inter(0, t, S, T);
} else {
ans += inter(0, t, 0, T);
ans += inter(0, t, S, PI * 2);
}
std::cout << std::fixed << std::setprecision(12);
std::cout << ans << '\n';
}