QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#749009 | #9576. Ordainer of Inexorable Judgment | PlentyOfPenalty# | WA | 3ms | 12900kb | C++20 | 2.9kb | 2024-11-14 22:21:51 | 2024-11-14 22:21:56 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-14 22:21:51]
- 提交
answer
#include <bits/stdc++.h>
#include <cmath>
#include <iomanip>
#define all(x) begin(x), end(x)
#define sz(x) ((int)(x).size())
#ifdef memset0
#define log(...) fprintf(stderr, __VA_ARGS__)
#else
#define endl '\n'
#define log(...) (void(0))
#endif
using namespace std;
using ll = long long;
using lf = long double;
using ull = unsigned long long;
const int N = 200011;
const lf pi = M_PI;
struct pt {
ll x, y;
pt(ll _x = 0, ll _y = 0) { x = _x, y = _y; }
pt operator-(const pt &you) { return pt(x - you.x, y - you.y); }
pt rotate() { return pt(-y, x); }
ll dot(pt you) { return (ll)x * you.x + (ll)y * you.y; }
ll len2() { return (ll)x * x + (ll)y * y; }
double angle() { return atan2(y, x); }
pt operator-() { return pt(-x, -y); }
} a[N];
lf dist(pt st, pt ed, pt p) {
pt r = p - st, v = ed - st;
return sqrtl(r.len2() - lf(r.dot(v)) * (r.dot(v)) / v.len2());
}
lf fx[N], U[N], L[N], R[N];
lf cover(lf l1, lf r1, lf l2, lf r2) {
if (l1 > l2) {
return cover(l2, r2, l1, r1);
}
return max(lf(0), min(r1, r2) - l2);
}
int main() {
#ifdef memset0
freopen("M.in", "r", stdin);
#endif
cin.tie(0)->sync_with_stdio(0);
int n, x0, y0, r, _t;
cin >> n >> x0 >> y0 >> r >> _t;
lf t = _t;
pt O(0, 0);
for (int i = 1; i <= n; ++i) {
cin >> a[i].x >> a[i].y;
if (a[i].len2() <= (ll)r * r) {
log("touched!!\n");
printf("%.9lf\n", double(t));
return 0;
}
}
// sort(a + 1, a + n + 1);
for (int i = 1; i <= n; ++i) {
U[i] = atan2l(a[i].y, a[i].x);
if (U[i] < 0) U[i] += 2 * pi;
lf ang = asinl(r / sqrtl(a[i].len2()));
L[i] = U[i] - ang;
R[i] = U[i] + ang;
if (L[i] < 0) {
L[i] += 2 * pi;
R[i] += 2 * pi;
}
}
lf ansl = 1000, ansr = -1000;
for (int i = 1; i <= n; i++) {
int f = i;
int g = i % n + 1;
lf diff = U[g] - U[f];
if (diff < 0) diff += 2 * pi;
lf l, r;
if (diff <= pi) {
l = L[f];
r = R[g];
} else {
l = L[g];
r = R[f];
}
log("f=%d g=%d l=%.5Lf r=%.5Lf\n", f, g, l, r);
if (r < l) {
r += 2 * pi;
}
ansl = min(ansl, l);
ansr = max(ansr, r);
}
log(">> ansl=%.10Lf ansr=%.10Lf\n", ansl, ansr);
if (ansr - ansl >= 2 * pi) {
log("all covered!!\n");
printf("%.9lf\n", double(t));
return 0;
}
lf len = ansr - ansl;
lf cir = floor(t / (2 * pi));
lf ans = len * cir;
lf s = atan2l(y0, x0);
if (s < 0) {
s += 2 * pi;
}
lf e = s + (t - 2 * pi * cir);
cerr << "cir: " << fixed << setprecision(12) << cir << endl;
log(">> s=%.10Lf e=%.10Lf\n", s, e);
log(">> %.10Lf\n", cover(ansl, ansr, s, e));
log(">> %.10Lf\n", cover(ansl, ansr, s + 2 * pi, e + 2 * pi));
ans += cover(ansl, ansr, s, e);
ans += cover(ansl, ansr, s + 2 * pi, e + 2 * pi);
cout << fixed << setprecision(12) << ans << endl;
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 12424kb
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: 3ms
memory: 11900kb
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: 3ms
memory: 11364kb
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: 12468kb
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: 12572kb
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: 0
Accepted
time: 0ms
memory: 12416kb
input:
4 1 0 1 10000 -2 3400 -4 10000 -4 -10000 -2 -3400
output:
4999.219115408743
result:
ok found '4999.2191154', expected '4999.2191154', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 11244kb
input:
4 1 0 1 10000 -2 3300 -4 10000 -4 -10000 -2 -3300
output:
4999.200391854815
result:
ok found '4999.2003919', expected '4999.2003919', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 11684kb
input:
4 -3040 2716 2147 2 -9033 -8520 -8999 -8533 -8988 -8511 -9004 -8495
output:
0.350830058342
result:
ok found '0.3508301', expected '0.3508301', error '0.0000000'
Test #9:
score: -100
Wrong Answer
time: 0ms
memory: 12900kb
input:
3 8168 -766 1549 1256 -3951 -6425 -3874 -6439 -3911 -6389
output:
84.408696855202
result:
wrong answer 1st numbers differ - expected: '84.8328612', found: '84.4086969', error = '0.0050000'