QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#309578 | #8022. Walker | Ebiarat# | WA | 1ms | 3896kb | C++20 | 1.2kb | 2024-01-20 18:38:22 | 2024-01-20 18:38:23 |
Judging History
answer
#include <iostream>
#include <string>
#include <set>
#include <map>
#include <algorithm>
#include <iomanip>
#include <vector>
#include <cmath>
#include <queue>
#include <sstream>
#include <ctime>
#include <iterator>
#include <string.h>
#include <stack>
#include <unordered_set>
#include <unordered_map>
#include <bitset>
#include <fstream>
#include <assert.h>
#include <numeric>
#include <complex>
#include <random>
#include <utility>
using namespace std;
int main() {
int i;
cin >> i;
while(i--){
long double n, p1, v1, p2, v2 ;
cin >> n >> p1 >> v1 >> p2 >> v2;
if(p1>p2) {
swap(v1,v2);
swap(p1,p2);
}
long double ans1, ans2, ans3, ans4, ans5, ans6, ans7;
ans1 = (n + min(p1, n-p1))/v1;
ans2 = (n + min(p2, n-p2))/v2;
ans3 = (n + p1 + n - p2)/(v1+v2);
ans4 = (n + p2 + n - p1)/(v1+v2);
ans5 = max((p2-p1 + p2)/v1, (n-p2)/v2 );
ans6 = max((p2-p1 + p1)/v2, p1/v1 );
ans7 = max((n-p1)/v1, p2/v2 );
cout << fixed << setprecision(10) << min({ans1, ans2, ans3, ans4, ans5, ans6, ans7}) << endl;
}
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.0000000000 3827.8370013755
result:
ok 2 numbers
Test #2:
score: 0
Accepted
time: 0ms
memory: 3824kb
input:
1 10.0 1.0 10.0 9.0 0.1
output:
1.1000000000
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #3:
score: 0
Accepted
time: 0ms
memory: 3896kb
input:
1 10.0 8.0 10.0 9.0 0.1
output:
1.2000000000
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #4:
score: 0
Accepted
time: 0ms
memory: 3756kb
input:
1 10.0 8.0 0.1 9.0 10
output:
1.1000000000
result:
ok found '1.1000000', expected '1.1000000', error '0.0000000'
Test #5:
score: 0
Accepted
time: 1ms
memory: 3816kb
input:
1 10.0 2.0 0.1 3.0 10
output:
1.3000000000
result:
ok found '1.3000000', expected '1.3000000', error '0.0000000'
Test #6:
score: 0
Accepted
time: 1ms
memory: 3832kb
input:
1 10.0 9.0 0.1 8.0 10.0
output:
1.2000000000
result:
ok found '1.2000000', expected '1.2000000', error '0.0000000'
Test #7:
score: 0
Accepted
time: 1ms
memory: 3896kb
input:
1 10.0 4.0 0.1 6.0 0.1
output:
60.0000000000
result:
ok found '60.0000000', expected '60.0000000', error '0.0000000'
Test #8:
score: -100
Wrong Answer
time: 1ms
memory: 3784kb
input:
1 10.0 4.5 0.1 6.0 0.1
output:
60.0000000000
result:
wrong answer 1st numbers differ - expected: '57.5000000', found: '60.0000000', error = '0.0434783'