QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#159158#7110. Kuririn MIRACLEucup-team180#WA 904ms127984kbC++141.7kb2023-09-02 17:33:592023-09-02 17:33:59

Judging History

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

  • [2023-09-02 17:33:59]
  • 评测
  • 测评结果:WA
  • 用时:904ms
  • 内存:127984kb
  • [2023-09-02 17:33:59]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
const int B = 8000000;
const long double PI = acos(-1);
int main(){
  cout << fixed << setprecision(20);
  auto calc = [&](long double x){
    return sqrt(1 + pow(sin(x), 2) / 3);
  };
  vector<long double> sum(B + 1);
  sum[0] = 0;
  for (int i = 0; i < B; i++){
    long double l = PI / B * i - PI;
    long double m = PI / B * (i + 0.5) - PI;
    long 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++){
    long double v, r, d;
    cin >> v >> r >> d;
    long 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){
        long double mid = (tv + fv) / 2;
        long double theta = PI / B * mid - PI;
        long double t = r * 2 / v * sum[mid];
        long double x = r * 2 + v * t + r * 2 * cos(theta);
        long double y = r * 2 * sin(theta);
        long double phi = atan2(-y, d - x);
        long 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;
        }
      }
      long double theta = PI / B * tv - PI;
      long double t = r * 2 / v * sum[tv];
      long double x = r * 2 + v * t + r * 2 * cos(theta);
      long double y = r * 2 * sin(theta);
      long 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: 899ms
memory: 127984kb

input:

1
2.00 3 30.0

output:

8.31057993390645336970

result:

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

Test #2:

score: -100
Wrong Answer
time: 904ms
memory: 127980kb

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.45783712273709847949
5.48836080899674438752
5.84869976359338061443
1.12368024132730015075
43.26648005353473230503
8.30549013820445364634
2.37735849056603773598
4.01548596951187010537
40.61056480077050950817
13.61882226231699236692
4.15512364357619012672
27.17896300708069080160
6.151776770979724410...

result:

wrong answer 9th numbers differ - expected: '37.9481481', found: '40.6105648', error = '0.0701593'