QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#721121 | #9576. Ordainer of Inexorable Judgment | ucup-team902# | WA | 0ms | 4368kb | C++20 | 2.4kb | 2024-11-07 15:18:57 | 2024-11-07 15:18:57 |
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-07 15:18:57]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
#define cs const
#define re register
#define pb push_back
#define y0 sxxxxx
#define pii pair<int, int>
#define ll long long
#define fi first
#define se second
#define bg begin
template <typename tp>
inline void chemx(tp &a, tp b) { (a < b) ? (a = b) : 0; }
template <typename tp>
inline void chemn(tp &a, tp b) { (a > b) ? (a = b) : 0; }
cs int N = 205;
cs double pi = acos(-1);
#define pd pair<double, double>
cs double eps = 1e-9;
int n, x0, y0, d, t;
vector<pd> inter;
void ins(double l, double r) {
if (l < 0) l += 2 * pi;
if(r<0)r+=2*pi;
if (r > 2 * pi + eps) r -= 2 * pi;
// cout<<l<<" "<<r<<'\n';
if (l + eps < r)
inter.pb(pd(l, r));
else
inter.pb(pd(l, 2 * pi)), inter.pb(pd(0, r));
}
void init() {
sort(inter.begin(), inter.end());
double lst = -1;
vector<pd> res;
for (int i = 0; i < inter.size(); i++) {
lst = inter[i].se;
int j = i;
while (j + 1 < inter.size() && inter[j + 1].fi < lst) {
j++;
lst = max(inter[j].se, lst);
}
res.pb(pd(inter[i].fi, lst));
i = j;
}
inter = res;
}
double calc(pd x, pd y) {
if (x.fi > y.fi) swap(x, y);
if (x.se < y.fi) return 0;
if (x.se > y.se) return y.se - y.fi;
return x.se - y.fi;
}
double query(double l, double r) {
// cout << l << " " << r << '\n';
double ans = 0;
for (pd x : inter) {
ans += calc(x, pd(l, r));
}
return ans;
}
void solve() {
cin >> n >> x0 >> y0 >> d >> t;
for (int i = 1; i <= n; i++) {
int x, y;
cin >> x >> y;
double p1 = atan2(y, x);
double dis = sqrt(x * x + y * y);
double del = asin(d / dis);
// cout<<dis<<" "<<d<<'\n';
// cout << p1 << " " << del << '\n';
ins(p1 - del, p1 + del);
}
init();
// for (pd x : inter) cout << x.fi << " " << x.se << '\n';
int cnt = t / (2 * pi);
double res = t - cnt * 2 * pi;
double p0 = atan2(y0, x0);
double ans = cnt * query(0, 2 * pi);
if (p0 + res > 2 * pi)
ans = ans + query(p0, 2 * pi) + query(0, p0 + res - 2 * pi);
else
ans = ans + query(p0, p0 + res);
printf("%.12lf\n", ans);
}
int main() {
// freopen("1.in","r",stdin);
int T = 1;
while (T--) solve();
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4232kb
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: 4368kb
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: 4236kb
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: 4296kb
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: -100
Wrong Answer
time: 0ms
memory: 4364kb
input:
3 -10000 -10000 10000 10000 -10000 -9999 -10000 -10000 -9999 -10000
output:
2499.455171841211
result:
wrong answer 1st numbers differ - expected: '2500.2406700', found: '2499.4551718', error = '0.0003142'