QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#576400 | #8022. Walker | aYi_7# | WA | 0ms | 4036kb | C++17 | 1.1kb | 2024-09-19 20:15:13 | 2024-09-19 20:15:13 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
using namespace std;
void solve() {
std::vector<double> ans;
double n, p1, v1, p2, v2;
std::cin >> n >> p1 >> v1 >> p2 >> v2;
if(p1 > p2) {
std::swap(p1, p2);
std::swap(v1, v2);
}
double len_L1 = p1 - 0, len_R1 = n - p1;
ans.emplace_back((n + std::min(len_L1, len_R1) * 2) / v1);
double len_L2 = p2 - 0, len_R2 = n - p2;
ans.emplace_back((n + std::min(len_L2, len_R2) * 2) / v2);
ans.emplace_back(std::max(len_R1 / v1, len_L2 / v2));
ans.emplace_back(std::max(len_L1 / v1, (n - len_L1 + len_R2) / v2));
ans.emplace_back(std::max((n - len_R2 + len_L1) / v1, len_R2 / v2));
ans.emplace_back((n + len_L1 + len_R2) / (v1 + v2));
double res = ans[0];
for(auto &i : ans) res = std::min(res, i);
// std::cout << res << '\n';
printf("%.20f\n", res);
}
signed main() {
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
int t = 1;
std::cin >> t;
for(int i = 0; i < t; ++i) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3836kb
input:
2 10000.0 1.0 0.001 9999.0 0.001 4306.063 4079.874 0.607 1033.423 0.847
output:
5001000.00000000000000000000 3827.83700137551613806863
result:
ok 2 numbers
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 4036kb
input:
1 10.0 1.0 10.0 9.0 0.1
output:
1.18811881188118806385
result:
wrong answer 1st numbers differ - expected: '1.1000000', found: '1.1881188', error = '0.0801080'