QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#745118 | #9576. Ordainer of Inexorable Judgment | PinkRabbit | WA | 1ms | 4356kb | C++20 | 2.2kb | 2024-11-14 05:07:44 | 2024-11-14 05:07:45 |
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-14 05:07:44]
- 提交
answer
#include <iostream>
#include <algorithm>
#include <vector>
#include <utility>
#include <set>
#include <cmath>
#include <iomanip>
using std::cin, std::cout;
#define F(i, a, b) for(int i = a; i <= (b); ++i)
#define F2(i, a, b) for(int i = a; i < (b); ++i)
#define dF(i, a, b) for(int i = a; i >= (b); --i)
void Solve();
int main() {
cin.sync_with_stdio(false);
cin.tie(nullptr);
int tests = 1;
while (tests--)
Solve();
return 0;
}
void Solve() {
int n, d;
double t;
cin >> n;
std::vector<double> x(n + 1), y(n + 1);
cin >> x[0] >> y[0] >> d >> t;
F(i, 1, n)
cin >> x[i] >> y[i];
{
int id = 0;
double pdis = 1e99;
F(i, 1, n) {
double dis = std::hypot(x[i], y[i]);
if (dis < pdis)
pdis = dis,
id = i;
}
double theta = -std::atan2(y[id], x[id]);
double cos = std::cos(theta);
double sin = std::sin(theta);
F(i, 0, n) {
double nx = cos * x[i] - sin * y[i];
double ny = sin * x[i] + cos * y[i];
x[i] = nx;
y[i] = ny;
}
}
double min_g = 1e9, max_g = -1e9;
F(i, 1, n) {
double theta = std::atan2(y[i], x[i]);
double phi = std::asin(d / std::hypot(x[i], y[i]));
min_g = std::min(min_g, theta - phi);
max_g = std::max(max_g, theta + phi);
}
// cout << min_g << ' ' << max_g << '\n';
double ans = 0;
const double pi = std::acos(-1);
double igamma = std::atan2(y[0], x[0]) + 2 * pi;
double t2 = igamma + t;
double t1 = igamma;
int nn;
//===
nn = t2 / (2 * pi);
ans += nn * (max_g - min_g);
t2 -= nn * (2 * pi);
if (t2 <= max_g)
ans += t2;
else {
ans += max_g;
if (t2 >= 2 * pi + min_g)
ans += t2 - (2 * pi + min_g);
}
//===
nn = t1 / (2 * pi);
ans -= nn * (max_g - min_g);
t1 -= nn * (2 * pi);
if (t1 <= max_g)
ans -= t2;
else {
ans -= max_g;
if (t1 >= 2 * pi + min_g)
ans -= t1 - (2 * pi + min_g);
}
//===
cout << std::fixed << std::setprecision(12) << ans << '\n';
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 4320kb
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: 1ms
memory: 4356kb
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: 1ms
memory: 4320kb
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: -100
Wrong Answer
time: 1ms
memory: 4264kb
input:
3 10000 10000 1 10000 10000 9999 10000 10000 9999 10000
output:
-3.067934976988
result:
wrong answer 1st numbers differ - expected: '0.3842413', found: '-3.0679350', error = '3.4521763'