QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#509583 | #8022. Walker | Xunwuqishi# | WA | 0ms | 3932kb | C++20 | 1.9kb | 2024-08-08 16:16:53 | 2024-08-08 16:16:54 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define lowbit(x) x&(-x)
#define int long long
#define double long double
const int N = 2e5+10;
double INF = 1e9;
int mod = 1e6+7;
//int mod = 1e9+7;
//int ways[4][2] = {{1,0},{-1,0},{0,1},{0,-1}};
double n,a,b,av,bv,ans;
void solve() {
cin>>n>>a>>av>>b>>bv;
if(a > b)
{
swap(a,b);
swap(av,bv);
}
double t;
ans = 4e18l;
ans = fmin(ans,(n + n - a) / av);
ans = fmin(ans,(n + n - b) / bv);
ans = fmin(ans,(a + n) / av);
ans = fmin(ans,(b + n) / bv);
t = (b - a) / (av + bv);
ans = fmin(ans,t + fmax((a + t * av) / av,(n - b + t * bv) / bv));
ans = fmin(ans,t + fmax((n - b + t * bv) / av,(a + t * av) / bv));
ans = fmin(ans,fmax((n - b) / bv,(b + a) / av));
ans = fmin(ans,fmax(a / av,(n - b + n - a) / bv));
ans = fmin(ans,fmax((n - b) / bv,(b - a + b - a + a) / av));
ans = fmin(ans,fmax(a / av,(b - a + b - a + n - b) / bv));
// if(a / av > (n - b) / bv)
// {
// double tt = a / av;
// double x = tt * bv - (n - b);
// ans = fmin(ans,tt + (n - x) / (av + bv));
// }else
// {
// double tt = (n - b) / bv;
// double x = tt * av - a;
// ans = fmin(ans,tt + (n - x) / (av + bv));
// }
double xx = (av * (2.0 * (b - a) + n - b) - a * bv) / (2.0 * (av + bv));
// for(double i = a;i <= b;i = i + 0.01)
// {
// cout<<max((2 * i + a) / av,(2 * (b - a - i) + n - b) / bv)<<'\n';
// }
// cout<<xx<<endl;
if(xx >= 0.0 && xx <= b - a)
{
ans = fmin(ans,(2 * xx + a) / av);
}
cout<<ans<<endl;
}
signed main() {
std::ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cout<<fixed<<setprecision(10);
int caset = 1;
cin>>caset;
for(int i = 1;i<=caset;i++)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3932kb
input:
2 10000.0 1.0 0.001 9999.0 0.001 4306.063 4079.874 0.607 1033.423 0.847
output:
9999000.0000000000 5056.7496561210
result:
wrong answer 1st numbers differ - expected: '5001000.0000000', found: '9999000.0000000', error = '0.9994001'