QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#162155 | #7110. Kuririn MIRACLE | ucup-team1198# | WA | 680ms | 50872kb | C++20 | 1.9kb | 2023-09-03 05:15:13 | 2023-09-03 05:15:14 |
Judging History
answer
#include <bits/stdc++.h>
#pragma GCC optimize("fast-math")
using namespace std;
#define ll long long
#define pii pair<int, int>
#define ld long double
#define all(a) (a).begin(), (a).end()
const ld pi = atan2l(1, 0) * 2;
const int T = 1000000;
ld pre3sin[T];
ld presin[T];
ld precos[T];
ld get_dphi(int phi, ld u, ld r) {
return (- u * presin[phi] + sqrtl(u * u * pre3sin[phi])) / (2 * r);
}
ld rush(int phi, ld r, ld v, ld d, ld t) {
d -= 2 * r + t * v;
ld x = - 2 * r * precos[phi];
ld y = 2 * r * presin[phi];
ld x1 = d - x;
ld y1 = y;
ld l = sqrtl(x1 * x1 + y1 * y1);
ld fac = 2 * v / l;
x1 *= fac;
y1 *= fac;
x1 -= v;
if (x1 * x > y * y1) {
// cerr << l << '\n';
return l / (2 * v);
} else {
return -1;
}
}
void solve() {
ld u, r, d;
u = 2.0;
r = 3;
d = 30;
cin >> u >> r >> d;
ld cur_t = 0;
for (int i = 0; i < T; ++i) {
// cur phi = pi * i / T
if (cur_t * u > (d - 2 * r)) {
break;
}
if (i * 2 > T) {
ld ost = rush(i, r, u, d, cur_t);
if (ost >= 0) {
// cerr <<
cout << cur_t + ost << '\n';
return;
}
}
ld dphi = get_dphi(i, u, r); // at further point better
cur_t += pi / T / dphi;
// ld phi = pi * i / T;
// cerr << phi / pi * 180 << '\n';
// cerr << cur_t << '\n';
}
cout << (d - r) / u << '\n';
}
signed main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
for (int i = 0; i < T; ++i) {
presin[i] = sinl(pi * i / T);
precos[i] = cosl(pi * i / T);
pre3sin[i] = presin[i] * presin[i] + 3;
}
cout << fixed << setprecision(15);
int t = 1000;
cin >> t;
while (t--) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 61ms
memory: 50764kb
input:
1 2.00 3 30.0
output:
8.310579328787181
result:
ok found '8.3105793', expected '8.3105799', error '0.0000001'
Test #2:
score: -100
Wrong Answer
time: 680ms
memory: 50872kb
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.457836738956736 5.488360517904196 3.560283687943262 -0.377073906485671 43.266476466923812 8.305489446633495 1.721698113207547 4.015485777152616 31.911111111111111 16.327319587628866 4.155123459912695 27.178961398315539 8.514545454545455 54.467889908256881 13.108910891089109 15.093993522255966 0.07...
result:
wrong answer 3rd numbers differ - expected: '5.8486998', found: '3.5602837', error = '0.3912692'