QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#696560 | #8022. Walker | MLK | WA | 1ms | 4016kb | C++14 | 918b | 2024-10-31 23:26:45 | 2024-10-31 23:26:46 |
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 ? (2*x+p1)/v1 : 0),(p2 < n - eps ? (n - p1 - p1 + p2 - x*2) / v2 : 0));
printf("%.20lf\n",min({a1,a2,a3,a4,a5,a6,a7,a8}));
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 1ms
memory: 4016kb
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: 3952kb
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: 4016kb
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: 3960kb
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: 3948kb
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: 3848kb
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: -100
Wrong Answer
time: 0ms
memory: 3944kb
input:
1 10.0 4.0 0.1 6.0 0.1
output:
70.00000000000000000000
result:
wrong answer 1st numbers differ - expected: '60.0000000', found: '70.0000000', error = '0.1666667'