QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#209959 | #7110. Kuririn MIRACLE | PetroTarnavskyi | WA | 282ms | 4492kb | C++17 | 1.5kb | 2023-10-10 20:27:13 | 2023-10-10 20:27:13 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define FOR(i, a, b) for(int i = (a); i < (b); i++)
#define RFOR(i, a, b) for(int i = (a) - 1; i >= (b); i--)
#define SZ(a) int(a.size())
#define ALL(a) a.begin(), a.end()
#define PB push_back
#define MP make_pair
#define F first
#define S second
typedef long long LL;
typedef vector<int> VI;
typedef pair<int, int> PII;
typedef double db;
const int M = 40000;
const db PI = acos(-1.0);
const db EPS = 1e-9;
db v, r, d;
db f(db phi)
{
db si = sin(phi);
return -v / (2 * r) * (sqrt(3 + si * si) - si);
}
void solve()
{
cin >> v >> r >> d;
db ans = d / v;
db phi = PI;
const db dt = ans / M;
FOR(i, 1, M + 1)
{
db t = i * dt;
db k1 = f(phi), k2 = f(phi + dt / 2 * k1), k3 = f(phi + dt / 2 * k2),
k4 = f(phi + dt * k3);
phi += dt / 6 * (k1 + 2 * k2 + 2 * k3 + k4);
db si = sin(phi);
if (phi < PI / 2)
{
db a = d - 2 * r - v * t;
if (a < 0)
continue;
db l = sqrt(4 * r * r + a * a - 4 * r * a * cos(phi));
db siBeta = 2 * r * si / l;
if (siBeta > 1 - EPS)
{
return;
}
db beta = asin(siBeta);
if (phi + beta <= PI / 2 && 2 * cos(phi + beta) >= cos(phi))
{
ans = min(ans, t + l / (2 * v));
break;
}
}
}
cout << ans << "\n";
//cerr << ans - 8.310579933902352 << "\n";
}
int main()
{
ios::sync_with_stdio(0);
cin.tie(0);
cout << fixed << setprecision(15);
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: 3ms
memory: 4300kb
input:
1 2.00 3 30.0
output:
8.310579933906595
result:
ok found '8.3105799', expected '8.3105799', error '0.0000000'
Test #2:
score: -100
Wrong Answer
time: 282ms
memory: 4492kb
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.457837122737101 5.488360808996865 5.848699763593380 1.123680241327300 43.266480053535147 8.305490138204620 2.377358490566038 4.015485969511906 12.329520141613770 4.155123643576228 27.178963007080721 5.845689064060930 15.093994461158864 1.017182130584192 6.949623502734063 8.150430299227976 6.810182...
result:
wrong answer 9th numbers differ - expected: '37.9481481', found: '12.3295201', error = '0.6750956'