QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#736212 | #9576. Ordainer of Inexorable Judgment | lqh2024 | Compile Error | / | / | C++20 | 4.3kb | 2024-11-12 06:41:28 | 2024-11-12 06:41:29 |
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-12 06:41:29]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2024-11-12 06:41:28]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
using f64 = long double;
template <class T, class ... A>
void debug(T t, A ... a) {
cerr << "[" << t;
((cerr << ", " << a), ...);
cerr << "]\n";
}
template <class T = f64>
struct point {
T x, y;
static constexpr T pi = acos(T(-1));
point(T x = {}, T y = {}) : x(x), y(y) {}
point operator - () const {
return point(-x, -y);
}
T operator * (const point & t) const {
return x * t.y - y * t.x;
}
T operator / (const point & t) const {
return x * t.x + y * t.y;
}
point operator + (const point & t) const {
return point(*this) += t;
}
point operator - (const point & t) const {
return point(*this) -= t;
}
point operator * (const T & t) const {
return point(*this) *= t;
}
point operator / (const T & t) const {
return point(*this) /= t;
}
point & operator += (const point & t) {
return x += t.x, y += t.y, *this;
}
point & operator -= (const point & t) {
return x -= t.x, y -= t.y, *this;
}
point & operator *= (const T & t) {
return x *= t, y *= t, *this;
}
point & operator /= (const T & t) {
return x /= t, y /= t, *this;
}
T square() const { return *this / *this; }
T len() const { return sqrt(square()); }
point rotat() const { return point(-y, x); }
point rotat(const T & t) const {
return point(x * cos(t) - y * sin(t), y * cos(t) + x * sin(t));
}
T theta() const {
T tmp = atan2(y, x);
if (tmp < 0) tmp += 2 * pi;
return tmp;
}
struct line {
point a, b;
line(point a = {}, point b = {}) : a(a), b(b) {}
point v() const { return b - a; }
T P_pos(const point & t) const {
return (t - a) * v();
}
T L_pos(const point & t) const {
return t.v() * v();
}
point L_inter(const line & t) const {
return a + v() * (t.P_pos(a) / L_pos(t));
}
};
struct circle {
point o;
T r;
circle(point o = {}, T r = {}) : o(o), r(r) {}
tuple<int, line, line> tangents(const point & t) const {
auto v = o - t;
if (v.square() < r * r) return {0, {}, {}};
if (v.square() == r * r) return {1, {t, t + v.rotat()}, {t, t + v.rotat()}};
T ang = asin(r / v.len());
return {2, {t, t + v.rotat(-ang)}, {t, t + v.rotat(ang)}};
}
};
};
using line = point<>::line;
using circle = point<>::circle;
constexpr f64 PI = point<>::pi;
void QAQ() {
int n;
f64 x0, y0, d, t;
cin >> n >> x0 >> y0 >> d >> t;
vector<point<>> a(n + 1);
circle cir({0, 0}, d);
for (int i = 1; i <= n; i++) {
cin >> a[i].x >> a[i].y;
}
f64 mx = 0, mn = 1e9;
for (int i = 1; i <= n; i++) {
auto [op, l1, l2] = cir.tangents(a[i]);
mx = max({mx, (-l1.v()).theta(), (-l2.v()).theta()});
mn = min({mn, (-l1.v()).theta(), (-l2.v()).theta()});
}
if (mx >= 3 * PI / 2 && mn <= PI / 2) {
for (int i = 1; i <= n; i++) {
a[i] = a[i].rotat();
}
point tmp(x0, y0);
tmp = tmp.rotat();
x0 = tmp.x, y0 = tmp.y;
mx = 0, mn = 1e9;
for (int i = 1; i <= n; i++) {
auto [op, l1, l2] = cir.tangents(a[i]);
mx = max({mx, (-l1.v()).theta(), (-l2.v()).theta()});
mn = min({mn, (-l1.v()).theta(), (-l2.v()).theta()});
}
}
auto get = [&](f64 t) {
f64 cnt = floor(t / (2 * PI)), res = 0;
t -= cnt * (2 * PI);
if (mx - mn >= PI) {
res += cnt * (2 * PI - mx + mn);
res += min(mn, t);
} else {
res += cnt * (mx - mn);
res += max<double>(0, min(mx, t) - mn);
}
return res;
};
debug(mx, mn, 3 * PI / 2, f1, f4);
cout << get(point<>(x0, y0).theta() + t) - get(point<>(x0, y0).theta()) << "\n";
}
signed main() {
cin.tie(0) -> sync_with_stdio(0);
int t = 1;
// cin >> t;
for (cout << fixed << setprecision(12); t--; QAQ());
}
Details
answer.code: In function ‘void QAQ()’: answer.code:149:31: error: ‘f1’ was not declared in this scope; did you mean ‘y1’? 149 | debug(mx, mn, 3 * PI / 2, f1, f4); | ^~ | y1 answer.code:149:35: error: ‘f4’ was not declared in this scope; did you mean ‘f64’? 149 | debug(mx, mn, 3 * PI / 2, f1, f4); | ^~ | f64