QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#159310 | #7110. Kuririn MIRACLE | ucup-team180# | WA | 368ms | 81348kb | C++14 | 1.8kb | 2023-09-02 17:46:16 | 2023-09-02 17:46:16 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int B = 10000000;
const double PI = acos(-1);
int main(){
cout << fixed << setprecision(20);
auto calc = [&](double x){
return sqrt(1 + pow(sin(x), 2) / 3);
};
vector<double> sum(B + 1);
sum[0] = 0;
for (int i = 0; i < B; i++){
double l = PI / B * i - PI;
double m = PI / B * (i + 0.5) - PI;
double r = PI / B * (i + 1) - PI;
sum[i + 1] = sum[i] + (calc(l) + calc(m) * 4 + calc(r)) / 6 * (PI / B);
}
for (int i = 0; i <= B; i++){
sum[i] /= sqrt(3);
sum[i] += (cos(PI / B * i - PI) + 1) / 3;
}
auto intg = [&](double x){
int cnt = floor((x + PI) / PI * B);
double ans = sum[cnt];
double l = PI / B * cnt - PI;
double r = x;
double m = (l + r) / 2;
ans += (calc(l) + calc(m) * 4 + calc(r)) / 6 * (r - l);
return ans;
};
int T;
cin >> T;
for (int i = 0; i < T; i++){
double v, r, d;
cin >> v >> r >> d;
double T0 = r * 2 / v * sum[B];
if (d < T0 * v){
cout << d / v << endl;
} else {
double tv = -PI / 2, fv = 0;
for (int j = 0; j < 100; j++){
double mid = (tv + fv) / 2;
double theta = mid;
double t = r * 2 / v * intg(mid);
double x = r * 2 + v * t + r * 2 * cos(theta);
double y = r * 2 * sin(theta);
double phi = atan2(-y, d - x);
double b = r * 4 * cos(theta) * (v * 2 * cos(phi) - v) + 8 * r * v * sin(theta) * sin(phi);
if (b < 0){
tv = mid;
} else {
fv = mid;
}
}
double theta = tv;
double t = r * 2 / v * intg(theta);
double x = r * 2 + v * t + r * 2 * cos(theta);
double y = r * 2 * sin(theta);
double ans = t + hypot(d - x, y) / (v * 2);
cout << ans << endl;
}
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 368ms
memory: 81348kb
input:
1 2.00 3 30.0
output:
8.31058001656812272984
result:
ok found '8.3105800', expected '8.3105799', error '0.0000000'
Test #2:
score: -100
Wrong Answer
time: 319ms
memory: 81208kb
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.45783715940698410662 5.48836085749826008140 5.84869976359337950811 1.12368024132730015552 43.26648017594580153400 8.30549020198032650342 2.37735849056603765206 4.01548606248353046055 40.61056890701688359968 13.61882384355020114697 4.15512365313968601299 27.17896305534889123123 6.151777526592945299...
result:
wrong answer 9th numbers differ - expected: '37.9481481', found: '40.6105689', error = '0.0701594'