QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#159137#7110. Kuririn MIRACLEucup-team180#WA 264ms81336kbC++141.6kb2023-09-02 17:31:462023-09-02 17:31:47

Judging History

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

  • [2023-09-02 17:31:47]
  • 评测
  • 测评结果:WA
  • 用时:264ms
  • 内存:81336kb
  • [2023-09-02 17:31:46]
  • 提交

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;
  }
  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 {
      int tv = B / 2, fv = B;
      while (fv - tv > 1){
        double mid = (tv + fv) / 2;
        double theta = PI / B * mid - PI;
        double t = r * 2 / v * sum[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 = PI / B * tv - PI;
      double t = r * 2 / v * sum[tv];
      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: 264ms
memory: 81304kb

input:

1
2.00 3 30.0

output:

8.31057993390677829382

result:

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

Test #2:

score: -100
Wrong Answer
time: 249ms
memory: 81336kb

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.45783712273718002450
5.48836080899698064428
5.84869976359337950811
1.12368024132730015552
43.26648005353524695238
8.30549013820470349856
2.37735849056603765206
4.01548596951207592554
40.61056562202431052810
13.61882257856534650386
4.15512364357618668720
27.17896300708069290408
6.151776922103163514...

result:

wrong answer 9th numbers differ - expected: '37.9481481', found: '40.6105656', error = '0.0701594'