QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#161387 | #7110. Kuririn MIRACLE | ucup-team004# | RE | 1ms | 4424kb | C++20 | 2.0kb | 2023-09-02 23:36:19 | 2023-09-02 23:36:20 |
Judging History
answer
#include <bits/stdc++.h>
using i64 = long long;
const double Pi = std::acos(-1.0);
constexpr double EPS = 1e-9;
double v, r, d;
double f(double x) {
double s = std::sin(x);
return 1 / v / (std::sqrt(s * s + 3) - s);
}
double simpson(double l, double r) {
return (f(l) + 4 * f((l + r) / 2) + f(r)) * (r - l) / 6;
}
double integral(double l, double r, double eps, double st) {
double mid = (l + r) / 2;
double sl = simpson(l, mid);
double sr = simpson(mid, r);
if (std::abs(sl + sr - st) <= 15 * eps)
return sl + sr + (sl + sr - st) / 15;
return integral(l, mid, eps / 2, sl) + integral(mid, r, eps / 2, sr);
}
double integral(double l, double r) {
return integral(l, r, EPS, simpson(l, r));
}
void solve() {
std::cin >> v >> r >> d;
r *= 2;
auto check = [&](double t) {
double x = d - v * t;
assert(x - r >= r);
double u = Pi - std::acos(r / (x - r));
double ans = 0;
double px = r - std::cos(u) * r;
double py = std::sin(u) * r;
double dis = std::sqrt((x - px) * (x - px) + py * py);
ans += integral(0, u) * r;
ans += dis * f(u);
// std::cerr << t << " " << ans << " " << u << " " << integral(0, u) * r << " " << dis << " " << dis * f(u) << "\n";
return ans <= t;
};
double ans = d / v;
double lo = 0, hi = (d - 2 * r) / v;
if (hi < lo) {
std::cout << ans << "\n";
return;
}
for (int _ = 0; _ < 100; _++) {
double t = (lo + hi) / 2;
if (check(t)) {
hi = t;
} else {
lo = t;
}
}
if (check(hi)) {
ans = hi;
}
std::cout << ans << "\n";
}
int main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
std::cout << std::fixed << std::setprecision(10);
int t;
std::cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4424kb
input:
1 2.00 3 30.0
output:
8.3105799339
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: -100
Dangerous Syscalls
input:
100 8.66 6.05 71.59 8.44 8.67 82.55 4.23 9.68 24.74 6.63 9.95 7.45 1.2 7.27 97.55 2.08 2.94 31.61 8.48 5.56 20.16 7.35 5.55 52.48 1.35 8.15 51.23 3.88 9.02 72.37 7.03 1.97 57.03 1.78 4.44 93.44 5.5 6.11 52.94 1.09 9.64 69.01 1.01 3.54 16.78 1.63 4.55 44.06 5.82 5.51 5.92 5.62 2.93 76.01 4.75 4.43 73...