QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#735848 | #9574. Strips | UESTC_NLNS | WA | 1ms | 3952kb | C++20 | 2.7kb | 2024-11-11 22:04:51 | 2024-11-11 22:04:52 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using ldb = long double;
const ldb pi = acosl(-1);
const ldb eps = 1e-12;
struct point {
ldb x, y;
point operator+(const point& o) const { return {x + o.x, y + o.y}; }
point operator-(const point& o) const { return {x - o.x, y - o.y}; }
ldb operator*(const point& o) const { return x * o.x + y * o.y; };
ldb operator^(const point& o) const { return x * o.y - y * o.x; };
point operator*(const ldb o) const { return {x * o, y * o}; };
point operator/(const ldb o) const { return {x / o, y / o}; };
ldb th() const {
ldb tmp = atan2l(y, x);
// cout << x << " " << y << " " << tmp << '\n';
return tmp < 0 ? tmp + 2 * pi : tmp;
};
ldb len() const { return sqrtl(x * x + y * y); }
point rot(const ldb cosr, const ldb sinr) const { return {x * cosr - y * sinr, x * sinr + y * cosr}; }
};
// using pii = pair<>
struct circle {
ldb r;
pair<ldb, ldb> targent(const point& a) const {
point e = a;
e = e / e.len() * r;
const ldb costh = r / a.len(), sinth = sqrt(1 - costh * costh);
const point t1 = e.rot(costh, -sinth), t2 = e.rot(costh, sinth);
return {(a - t1).th(), (a - t2).th()};
}
};
int main() {
int n, __x, __y, d;
ldb t;
ldb th;
cin >> n >> __x >> __y >> d >> t;
th = point{(ldb)__x, (ldb)__y}.th();
vector<point> a(n);
int vis[5];
vis[1] = vis[4] = 0;
for (int i = 0; i < n; ++i) {
cin >> a[i].x >> a[i].y;
vis[1] |= a[i].x > 0 && a[i].y > 0;
vis[4] |= a[i].x > 0 && a[i].y < 0;
}
circle c(d);
ldb mx = 0;
ldb mn = 3 * pi;
if (vis[1] && vis[4]) {
th = th <= pi ? th + pi : th - pi;
for (int i = 0; i < n; ++i) a[i] = a[i] * (-1);
}
for (int i = 0; i < n; ++i) {
auto [t1, t2] = c.targent(a[i]);
// cout << a[i].x << " " << a[i].y << " " << t1 << " " << t2 << '\n';
mn = min(min(t1, mn), t2);
mx = max(max(t1, t2), mx);
}
ldb ans = 0;
int n1 = t / (2 * pi);
t = t - n1 * (2 * pi);
ans += n1 * (mx - mn);
// cout << mx << " " << mn << '\n';
if (mn < th && th < mx) {
ldb tmp = min(t, mx - th);
ans += tmp;
ans += max((ldb)0, th + t - 2 * pi - mn);
} else {
if (th > mx) th -= 2 * pi;
// cout << th << '\n';
// cout << th + t << '\n';
if (th + t < mn) {
} else if (th + t > mx) {
ans += mx - mn;
} else {
ans += th + t - mn;
}
}
// cout << ans << '\n';
printf("%.8LF", ans);
}
/*
3 1 0 1 1
1 2
2 1
2 2
*/
詳細信息
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3952kb
input:
4 5 2 3 16 7 11 2 9 14 13 5 3 2 4 11 6 10 2 1 11 2 1 2 6 1 5 3 2 1 2 6 1 5 2
output:
4.67016624
result:
wrong output format Expected integer, but "4.67016624" found (test case 1)