QOJ.ac
QOJ
The 2nd Universal Cup Finals is coming! Check out our event page, schedule, and competition rules!
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#743387 | #8022. Walker | Foracy | TL | 0ms | 0kb | C++20 | 963b | 2024-11-13 19:05:52 | 2024-11-13 19:05:53 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
using LL = long long;
double n,a,va,b,vb;
bool check(double t){
double a1 = (va*t - a);
double a2 = (va*t - a) / 2 + a;
double b1 = (vb*t - (n-b));
double b2 = (vb*t - (n-b)) / 2 + (n-b);
if (a1+b1 >= n || a1+b2 >= n || a2+b1 >= n || a2+b2 >= n){
return 1;
}
return 0;
}
int main(){
cout << fixed << setprecision(10);
int T;
cin >> T;
while (T--){
cin >> n >> a >> va >> b >> vb;
if (a > b){
swap(a,b);
swap(va,vb);
}
double case1 = min({(n+a)/va,(n+b)/vb,max((n-a)/va,(n-b)/vb)});
double lo = 0, hi = case1;
while (lo <= hi){
double mid = (lo + hi) / 2;
if (check(mid)){
hi = mid - 0.0000000001;
} else{
lo = mid + 0.0000000001;
}
}
cout << lo << '\n';
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Time Limit Exceeded
input:
2 10000.0 1.0 0.001 9999.0 0.001 4306.063 4079.874 0.607 1033.423 0.847