QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#762681 | #9576. Ordainer of Inexorable Judgment | Meowmeowmeow | WA | 1ms | 4368kb | C++17 | 2.5kb | 2024-11-19 16:09:01 | 2024-11-19 16:09:02 |
Judging History
你现在查看的是最新测评结果
- [2024-12-23 14:23:26]
- hack成功,自动添加数据
- (/hack/1303)
- [2024-12-06 11:32:56]
- hack成功,自动添加数据
- (/hack/1271)
- [2024-11-19 16:09:01]
- 提交
answer
#include <bits/stdc++.h>
#define x first
#define y second
using namespace std;
typedef double db;
typedef pair<int, int> PII;
const int N = 110;
const db PI = acos(-1);
int n, sx, sy, d, t, order[N], cnt;
PII cv[N];
db rads[N], alpha[N], rr[2], res, ans, true_ans = 0;
void rotate90(int &x, int &y) {
int t = y;
y = x, x = -t;
}
db rad(int x, int y) {
return atan2(y, x);
}
bool check() {
for(int i = 1; i <= n; i ++) {
if(cv[i].x <= 0 && cv[i].y <= 0) return false;
}
bool ok = false;
for(int i = 1; i <= n; i ++) {
if(cv[i].x > 0 && cv[i].y > 0) return false;
}
return ok;
}
db dist(int x, int y) {
return sqrt(x*x + y*y);
}
db shift(db r) {
db ret = r + 3./4 * PI;
ret = ret - int(ret/2/PI)*2*PI;
while(ret >= 2*PI) ret -= 2*PI;
while(ret < 0) ret += 2*PI;
return ret;
}
void work() {
rads[0] = rad(sx, sy);
iota(order+1, order+n+1, 1);
for(int i = 1; i <= n; i ++) rads[i] = rad(cv[i].x, cv[i].y);
for(int i = 1; i <= n; i ++) alpha[i] = asin(1.*d/dist(cv[i].x, cv[i].y));
sort(order+1, order+n+1, [](auto x, auto y) {
return shift(rads[x]-alpha[x]) < shift(rads[y]-alpha[y]);
});
rr[0] = shift(rads[order[1]] - alpha[order[1]]);
sort(order+1, order+n+1, [](auto x, auto y) {
return shift(rads[x]+alpha[x]) < shift(rads[y]+alpha[y]);
});
rr[1] = shift(rads[order[n]] + alpha[order[n]]);
ans = 1.*cnt * (rr[1]-rr[0]);
// cerr << ans << '\n';
rads[0] = shift(rads[0]);
// cerr << rr[0]/PI << ' ' << rr[1]/PI << ' ' << rads[0]/PI << ' ' << res/PI << '\n';
if(rads[0] >= rr[0] && rads[0] <= rr[1]) {
ans += min(rr[1]-rads[0], res);
res -= rr[1]-rads[0];
if(res >= 2*PI-rads[0] + rr[0]) {
res -= 2*PI-rads[0] + rr[0];
ans += min(rr[1]-rr[0], res);
}
}
else {
if(rads[0] > rr[1] && res >= 2*PI-rads[0] + rr[0]) {
res -= 2*PI-rads[0] + rr[0];
ans += min(rr[1]-rr[0], res);
}
if(rads[0] < rr[0] && res >= rr[0]-rads[0]) {
res -= rr[0]-rads[0];
// cerr << res << ' ' << rr[1]-rr[0] << '\n';
ans += min(rr[1]-rr[0], res);
}
}
// cout << ans << '\n';
}
int main() {
ios::sync_with_stdio(0); cin.tie(0);
cout << fixed << setprecision(12);
cin >> n >> sx >> sy >> d >> t;
for(int i = 1; i <= n; i ++) cin >> cv[i].x >> cv[i].y;
true_ans = 0;
for(int u = 0; u < 4; u ++) {
// if(check()) break;
cnt = 1.*t/2/PI;
res = t - 1.*cnt*2*PI;
work();
true_ans = max(true_ans, ans);
rotate90(sx, sy);
for(int i = 1; i <= n; i ++) rotate90(cv[i].x, cv[i].y);
}
cout << true_ans << '\n';
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 1ms
memory: 4368kb
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: 4312kb
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: 4036kb
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: 4276kb
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: 4300kb
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: -100
Wrong Answer
time: 0ms
memory: 4200kb
input:
4 1 0 1 10000 -2 3400 -4 10000 -4 -10000 -2 -3400
output:
5002.653237235493
result:
wrong answer 1st numbers differ - expected: '4999.2191154', found: '5002.6532372', error = '0.0006869'