QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#696604 | #8022. Walker | MLK | WA | 0ms | 4012kb | C++14 | 1.2kb | 2024-10-31 23:45:41 | 2024-10-31 23:45:41 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
double n;
double p1,p2;
double v1,v2;
const double eps = 1e-8;
int main()
{
int T;
cin >> T;
while(T -- ){
cin >> n >> p1 >> v1 >> p2 >> v2;
if(p1 > p2) swap(p1,p2),swap(v1,v2);
double a1 = (p1 + n) / v1;
double a2 = (n - p1 + n) / v1;
double a3 = (p2 + n) / v2;
double a4 = (n - p2 + n) / v2;
double a5 = max((n - p2) / v2,min((p1 + p2) / v1,(p2 + p2 - p1) / v1));
double a6 = max(p1 / v1,min((n + n - p1 - p2) / v2,(p2 - p1 + n - p1) / v2));
double a7 = (n + n - p2 + p1) / (v1 + v2);
double t = (p2 - p1) / (v1 + v2),x = v1 * t;
double a8 = t + max((p1 > eps ? (x+p1)/v1 : 0),(p2 < n - eps ? (n - p1 - x) / v2 : 0));
double a9 = 1e18;
x = (p1*v2+p2*v1+n*v1)/(v1*2+v2*2);
if(x >= p1 && x <= p2) a9 = (x*2-p1)/v1;
//cout << x << ' ' << a9 << '\n';
//cout << t << ' ' << x << ' ' << max((p1 > eps ? (2*x+p1)/v1 : 0),(p2 < n - eps ? (n - p1 - p1 + p2 - x*2) / v2 : 0)) << '\n';
printf("%.20lf\n",min({a1,a2,a3,a4,a5,a6,a7,a8,a9}));
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3948kb
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: 0
Accepted
time: 0ms
memory: 3940kb
input:
1 10.0 1.0 10.0 9.0 0.1
output:
1.10000000000000008882
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3760kb
input:
1 10.0 8.0 10.0 9.0 0.1
output:
1.19999999999999995559
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3836kb
input:
1 10.0 8.0 0.1 9.0 10
output:
1.10000000000000008882
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #5:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
1 10.0 2.0 0.1 3.0 10
output:
1.30000000000000004441
result:
ok found '1.3000000', expected '1.3000000', error '0.0000000'
Test #6:
score: 0
Accepted
time: 0ms
memory: 3828kb
input:
1 10.0 9.0 0.1 8.0 10.0
output:
1.19999999999999995559
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 0ms
memory: 3948kb
input:
1 10.0 4.0 0.1 6.0 0.1
output:
60.00000000000000000000
result:
ok found '60.0000000', expected '60.0000000', error '0.0000000'
Test #8:
score: 0
Accepted
time: 0ms
memory: 4012kb
input:
1 10.0 4.5 0.1 6.0 0.1
output:
57.49999999999997868372
result:
ok found '57.5000000', expected '57.5000000', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3952kb
input:
1 10.0 1.0 1.0 8.0 1.0
output:
6.50000000000000000000
result:
ok found '6.5000000', expected '6.5000000', error '0.0000000'
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 3840kb
input:
1 10.0 3.0 2.0 7.0 1.0
output:
4.66666666666666696273
result:
wrong answer 1st numbers differ - expected: '4.6000000', found: '4.6666667', error = '0.0144928'