QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#423468 | #7110. Kuririn MIRACLE | ucup-team3215 | WA | 46ms | 3984kb | C++20 | 1.7kb | 2024-05-28 03:13:01 | 2024-05-28 03:13:02 |
Judging History
answer
#include <array>
#include <cmath>
#include <iostream>
using namespace std;
double midpoint(double r, double d, double mt, double h, auto& deriv) {
double x = 0, y = 0, t = 0, c = 1;
auto mp = [&] {
auto [dx, dy] = deriv(x, y, t);
return deriv(x + dx * h * c / 2, y + dy * h * c / 2, t + h * c / 2);
};
while (1) {
// cout << t << ' ' << x << ' ' << y << ' ' << (x - t - 2 * r) * (x - t - 2 * r) + y * y - 4 * r * r << '\n';
if (t >= mt) return 1. / 0;
if (c < 1e-9) return t + sqrt((x - d) * (x - d) + y * y) / 2;
auto [dx, dy] = mp();
auto nx = x + dx * h * c, ny = y + dy * h * c, nt = t + h * c;
auto [ndx, ndy] = deriv(nx, ny, nt);
if (ndy < 0 && nx - ny / ndy * ndx < d) { c /= 2; continue; }
x = nx, y = ny, t = nt;
double coef = sqrt(((x - t - 2 * r) * (x - t - 2 * r) + y * y) / (4 * r * r));
// if (abs(coef - 1) > 1e-12) {
// x = (t + 2 * r) + (x - t - 2 * r) / coef;
// y = y / coef;
// }
}
}
int main() {
cin.tie(0)->sync_with_stdio(0);
for (int tc = (cin >> tc, tc); tc--; ) {
double v, r, d; cin >> v >> r >> d;
auto deriv = [&](double x, double y, double t) -> array<double, 2> {
double dx = x - t - 2 * r;
if (abs(dx) < y) {
double r = -dx / y, rr = r * r;
double ux = (rr + sqrt(3 * rr + 4)) / (1 + rr);
return {ux, (ux - 1) * r};
} else {
double r = -y / dx, rr = r * r, d = sqrt(4 * rr + 3);
double uy = (-r + (dx < 0? d: -d)) / (1 + rr);
return {uy * r + 1, uy};
}
};
cout.precision(20);
double ans = d;
if (d >= 7 * r) ans = min(ans, midpoint(r, d, d - 4 * r, (d - 4 * r) / 3e3, deriv));
cout << ans / v << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 3736kb
input:
1 2.00 3 30.0
output:
8.3105792887990865836
result:
ok found '8.3105793', expected '8.3105799', error '0.0000001'
Test #2:
score: 0
Accepted
time: 3ms
memory: 3976kb
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...
output:
4.4578367154920934823 5.4883603696019971352 5.8486997635933795081 1.1236802413273001555 43.266475361664831212 8.3054894607401372753 2.3773584905660376521 4.0154856424957348082 37.948148148148142411 18.652061855670105217 4.1551223948414328646 27.178957551173688501 9.6254545454545450411 63.31192660550...
result:
ok 100 numbers
Test #3:
score: -100
Wrong Answer
time: 46ms
memory: 3984kb
input:
1000 7.52 6.68 80.67 5.34 6.82 45.75 3.57 6.35 22.35 9.55 3.65 31.38 9.37 5.73 40.42 1.83 8.38 82.97 4.86 6.13 9.45 3.88 5.34 84.19 6.49 4.15 85.24 6.51 7.23 42.97 3.0 5.98 57.53 9.35 2.76 69.07 6.76 9.16 91.24 2.98 9.89 49.2 9.16 3.85 66.14 1.84 3.03 37.43 8.01 5.04 50.98 4.05 9.86 4.76 5.4 5.49 60...
output:
5.7708821077148622081 8.5674157303370783723 6.2605042016806731198 3.2858638743455492737 4.3137673425827109952 25.176482219491035153 1.9444444444444441977 11.406298066381284073 6.8071898820242635608 6.6006144393241168444 10.727711715951869564 3.8001968919117734558 7.4844837220015749679 16.51006711409...
result:
wrong answer 94th numbers differ - expected: '39.3512283', found: '39.3511841', error = '0.0000011'