QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#919762 | #7110. Kuririn MIRACLE | UnratedLegendaryGrandMasters (Emanuel Enrique Soto Ortega, Mijail Frank Poccohuanca Copac, Joel Jhotan Chavez Chico) | AC ✓ | 43ms | 4224kb | C++20 | 1.8kb | 2025-02-28 13:01:00 | 2025-02-28 13:01:01 |
Judging History
answer
//The 2018 ACM-ICPC Asia Qingdao Regional Contest, Online (The 2nd Universal Cup. Stage 1: Qingdao)
//Problem I. Kuririn MIRACLE
#include<bits/stdc++.h>
using namespace std;
using db = double;
const db pi = acos(-1);
const db eps = 1e-9;
const int N = 100 ; // number of steps (already multiplied by 2)
db f(db x){
return 1.0 / (sqrtl(4 - cos(x)*cos(x)) - sin(x));
}
db simpson_integration(db a, db b){
db h = (b - a) / N;
db s = f(a) + f(b); // a = x_0 and b = x_2n
for (int i = 1; i <= N - 1; ++i) { // Refer to final Simpson's formula
db x = a + h * i;
s += f(x) * ((i & 1) ? 4 : 2);
}
s *= h / 3;
return s;
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout<<setprecision(12)<<fixed;
int t;
cin>>t;
while(t--){
db v,r,d;
cin>>v>>r>>d;
db lo = pi/2 + eps, hi = pi;
auto tiempo = [&](db theta) -> db{
db t1 = 2*r*simpson_integration(0, theta)/v;
db vf = v*(sqrtl(4 - cos(theta)*cos(theta)) - sin(theta));
db t2 = 2*r*tan(pi - theta)/vf;
return t1 + t2;
};
auto solve = [&](db theta) -> db{
//cout<<tiempo(theta)<<" tiempo \n";
return 2*r + 2*r/cos(pi - theta) + v*tiempo(theta);
};
if(solve(hi) > d){
/*cout<<solve((lo + hi)/3)<<"\n";
cout<<solve((lo + hi)/2)<<"\n";
cout<<solve((lo + hi)*2/3)<<"\n";*/
cout<<d/v<<"\n";
continue;
}
int niter = 50;
while(niter--){
db mi = (lo + hi)/2;
if(solve(mi) <= d) hi = mi;
else lo = mi;
}
cout<<min(tiempo(lo), d/v)<<"\n";
}
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 4224kb
input:
1 2.00 3 30.0
output:
8.310579937616
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: 0
Accepted
time: 4ms
memory: 4224kb
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.457837123514 5.488360812728 5.848699763593 1.123680241327 43.266480058128 8.305490140534 2.377358490566 4.015485972450 37.948148148148 18.652061855670 4.155123643644 27.178963007918 9.625454545455 63.311926605505 16.613861386139 15.093994469897 1.017182130584 6.949623502873 8.150430299670 8.858447...
result:
ok 100 numbers
Test #3:
score: 0
Accepted
time: 43ms
memory: 4096kb
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.770882650173 8.567415730337 6.260504201681 3.285863874346 4.313767342583 25.176484184176 1.944444444444 11.406299617096 6.807191205878 6.600614439324 10.727712567421 3.800197844902 7.484484306071 16.510067114094 3.775697012344 10.915711072041 3.517527647493 1.175308641975 6.095287440431 14.4431818...
result:
ok 1000 numbers
Extra Test:
score: 0
Extra Test Passed