QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#162968#7110. Kuririn MIRACLEucup-team1196TL 109ms4308kbC++233.0kb2023-09-03 18:18:372023-09-03 18:18:37

Judging History

你现在查看的是最新测评结果

  • [2023-09-03 18:18:37]
  • 评测
  • 测评结果:TL
  • 用时:109ms
  • 内存:4308kb
  • [2023-09-03 18:18:37]
  • 提交

answer

/*
     _/_/_/              _/                     _/_/_/                                               
  _/           _/_/_/                        _/         _/    _/    _/_/_/   _/_/_/       _/_/_/   
 _/         _/    _/   _/                   _/  _/_/   _/    _/  _/    _/   _/    _/   _/    _/    
_/         _/    _/   _/                   _/    _/   _/    _/  _/    _/   _/    _/   _/    _/     
 _/_/_/     _/_/_/   _/                     _/_/_/     _/_/_/    _/_/_/   _/    _/     _/_/_/      
                            _/_/_/_/_/                                                    _/       
                                                                                     _/_/_/
*/
#include <bits/stdc++.h>

using namespace std;

constexpr double pi = acos(-1.0l);
constexpr double eps = 1e-9;
#define hps eps*0.5
double a, b, v, r, d;

double f(double x) {
    return (double)2.0l * r / v / (sqrtl(3.0l + sinl(x) * sinl(x)) - sinl(x));
}

double simpson(double l,double r){
    return (r-l)*(f(l)+f(r)+4.0l*f((l+r)/2.0l))/6.0l;
}

double jf(double l,double r,double ans,double step){
    double mid=(1.0l*l+r)/2.0l;
    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';
    double l = 1.0l*pi/2.0l, rr = pi;
    auto check = [&](double mid) {
        double t = jf((double)0.0l, mid, simpson(0.0l, mid), 0.0l);
        double dis = 2.0l * r + v * t;
        //cout<<mid<<'\n';
        //cout << dis << '\n';
        double delta = d - dis;
        double shengyu = pi - mid;
        //cout << delta << '\n';
        double dd = sqrt(delta * delta + 4 * r * r - 4 * r * delta * cos(shengyu));
        double s1 = 2 * r * sin(shengyu) / dd;
        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 <= 100; i++) {
        double mid = (l + rr) / 2;
        if(check(mid)) {
            rr = mid;
        } else {
            l = mid;
        }
    }
    double t = jf((double)0.0l, rr, simpson(0, rr), 0);
    double shengyu = pi - rr;
    double dis = 2.0l * r + v * t;
    double delta = d - dis;
    double py = 2 *r*sin(shengyu);
    double px = 2 *r*cos(shengyu);
    double dd = sqrt(delta * delta + 4 * r * r - 4 * r * delta * cos(shengyu));
    // cout << t << '\n';
    double t2 = d / v,he = (d - 4 * r ) / v;
    cout << fixed << setprecision(10) << '\n';
    if(t+dd /2 / v > he)
    cout << t2 << '\n';
    else
    cout << 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;
}

詳細信息

Test #1:

score: 100
Accepted
time: 2ms
memory: 4308kb

input:

1
2.00 3 30.0

output:


8.3105799566

result:

ok found '8.3105800', expected '8.3105799', error '0.0000000'

Test #2:

score: 0
Accepted
time: 109ms
memory: 4304kb

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.4578371330

5.4883608307

5.8486997636

1.1236802413

43.2664800858

8.3054901571

2.3773584906

4.0154860009

37.9481481481

18.6520618557

4.1551236497

27.1789630139

9.6254545455

63.3119266055

16.6138613861

15.0939945133

1.0171821306

6.9496235167

8.1504303414

8.8584474886

1.7697642164...

result:

ok 100 numbers

Test #3:

score: -100
Time Limit Exceeded

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.7708826606

8.5674157303

6.2605042017

3.2858638743

4.3137673426

25.1764842491

1.9444444444

11.4062996263

6.8071912335

6.6006144393

10.7277126092

3.8001978533

7.4844843240

16.5100671141

3.7756970302

10.9157110785

3.5175276608

1.1753086420

6.0952874502

14.4431818182

8.4168241292
...

result: