QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#656835 | #8022. Walker | yumingsk# | WA | 0ms | 3940kb | C++20 | 1.4kb | 2024-10-19 13:45:55 | 2024-10-19 13:45:56 |
Judging History
answer
#pragma GCC optimize(3, "Ofast", "inline")
#include <iostream>
#include <bits/stdc++.h>
#define IOS ios::sync_with_stdio(false), cin.tie(0), cout.tie(0)
#define INF 0x3f3f3f3f
#define L_INF 0x7f3f3f3f3f3f3f3f
#define db cout << "debug\n";
using namespace std;
const int Mod = 998244353;
using ll = long long;
double abs2(double a) { return a < 0 ? -a : a; }
double max(double a, double b) { return a > b ? a : b; }
double min(double a, double b) { return a < b ? a : b; }
double n, p1, p2, v1, v2, t, minn;
void solve()
{
cin >> n >> p1 >> v1 >> p2 >> v2;
if (p2 < p1)
{
t = p1;
p1 = p2;
p2 = t;
t = v1;
v1 = v2;
v2 = t;
}
minn = min((n / 2 - abs2(n / 2 - p1) + n) / v1, (n / 2 - abs2(n / 2 - p2) + n) / v2);
minn = min(minn, (n * 2 - p2 + p1) / (v1 + v2));
t = (n + p2 - p1) / (v1 + v2);
if (t - p1 / v1 >= 0 && t - ((n - p2) / v2) >= 0)
minn = min(minn, t);
cout << fixed << setprecision(10) << minn << '\n';
}
int main()
{
IOS;
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
#ifndef ONLINE_JUDGE
clock_t start_time = clock();
#endif
int t = 1;
cin >> t;
while (t--)
{
solve();
}
#ifndef ONLINE_JUDGE
cout << "Used " << (double)(clock() - start_time) << " ms" << endl;
#endif
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3940kb
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: 3848kb
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: 3852kb
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: 3912kb
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: 0ms
memory: 3848kb
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: 0ms
memory: 3892kb
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: 0ms
memory: 3856kb
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: 0
Accepted
time: 0ms
memory: 3852kb
input:
1 10.0 4.5 0.1 6.0 0.1
output:
57.5000000000
result:
ok found '57.5000000', expected '57.5000000', error '0.0000000'
Test #9:
score: 0
Accepted
time: 0ms
memory: 3832kb
input:
1 10.0 1.0 1.0 8.0 1.0
output:
6.5000000000
result:
ok found '6.5000000', expected '6.5000000', error '0.0000000'
Test #10:
score: -100
Wrong Answer
time: 0ms
memory: 3896kb
input:
1 10.0 3.0 2.0 7.0 1.0
output:
4.6666666667
result:
wrong answer 1st numbers differ - expected: '4.6000000', found: '4.6666667', error = '0.0144928'