QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#162939 | #7110. Kuririn MIRACLE | ucup-team1196 | TL | 19ms | 3604kb | C++23 | 3.1kb | 2023-09-03 17:56:08 | 2023-09-03 17:56:08 |
Judging History
answer
/*
_/_/_/ _/ _/_/_/
_/ _/_/_/ _/ _/ _/ _/_/_/ _/_/_/ _/_/_/
_/ _/ _/ _/ _/ _/_/ _/ _/ _/ _/ _/ _/ _/ _/
_/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/
_/_/_/ _/_/_/ _/ _/_/_/ _/_/_/ _/_/_/ _/ _/ _/_/_/
_/_/_/_/_/ _/
_/_/_/
*/
#include <bits/stdc++.h>
using namespace std;
constexpr long double pi = acos(-1.0l);
constexpr long double eps = 1e-12;
#define hps eps*0.5
long double a, b, v, r, d;
long double f(long double x) {
return (long double)2.0l * r / v / (sqrtl(3.0l + sinl(x) * sinl(x)) - sinl(x));
}
long double simpson(long double l,long double r){
return (r-l)*(f(l)+f(r)+4.0l*f((l+r)/2.0l))/6.0l;
}
long double jf(long double l,long double r,long double ans,long double step){
long double mid=(1.0l*l+r)/2.0l;
long double fl=simpson(l,mid),fr=simpson(mid,r);
if(abs(fl+fr-ans)<15.0l*eps&&step<0.0l) return ans;
else return jf(l,mid,fl,step-1.0l)+jf(mid,r,fr,step-1.0l);
}
void solve()
{
srand(998244353);
cin >> v >> r >> d;
// cout << v << ' ' << r << ' ' << d << '\n';
long double l = 1.0l*pi/2.0l, rr = pi;
auto check = [&](long double mid) {
long double t = jf((long double)0.0l, mid, simpson(0.0l, mid), 0.0l);
long double dis = 2.0l * r + v * t;
//cout<<mid<<'\n';
//cout << dis << '\n';
long double delta = d - dis;
long double shengyu = pi - mid;
//cout << delta << '\n';
long double dd = sqrt(delta * delta + 4 * r * r - 4 * r * delta * cos(shengyu));
long double s1 = 2 * r * sin(shengyu) / dd;
long double s2 = (sqrtl(3.0l + sinl(mid) * sinl(mid)) - sinl(mid)) * cos(mid) / -2 ;
//cout<<shengyu<<" "<<s2<<"\n";
if(s2 < s1) {
return false;
} return true;
};
for(int i = 1; i <= 300; i++) {
long double mid = (l + rr) / 2;
if(check(mid)) {
rr = mid;
} else {
l = mid;
}
}
long double t = jf((long double)0.0l, rr, simpson(0, rr), 0);
long double shengyu = pi - rr;
long double dis = 2.0l * r + v * t;
long double delta = d - dis;
long double py = 2 *r*sin(shengyu);
long double px = 2 *r*cos(shengyu);
long double dd = sqrt(delta * delta + 4 * r * r - 4 * r * delta * cos(shengyu));
// cout << t << '\n';
long double t2 = d / v;
cout << fixed << setprecision(10) << '\n';
cout << min(t2 , t + dd / 2 / v)<< '\n';
}
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
int t;
cin >> t;
while(t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 19ms
memory: 3604kb
input:
1 2.00 3 30.0
output:
8.3105799340
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: -100
Time Limit Exceeded
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...