QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#725048#8022. WalkernnkWA 1ms3944kbC++201.0kb2024-11-08 16:02:112024-11-08 16:02:13

Judging History

你现在查看的是最新测评结果

  • [2024-11-08 16:02:13]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3944kb
  • [2024-11-08 16:02:11]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
#define N 500005
using namespace std;
void solve()
{
    double p1, v1, p2, v2, ans, n;
    cin >> n >> p1 >> v1 >> p2 >> v2;
    if (p1 > p2) {
        swap(p1, p2);
        swap(v1, v2);
    }
    ans = (min(p1, n - p1) + n) / v1;
    ans = min(ans, (min(p2, n - p2) + n) / v2);
    ans = min(ans, (n + p1 + (n - p2)) / (v1 + v2));
    int t1 = (p2 - p1) / (v1 + v2), x = v1 * t1 + p1, x2;
    ans = min({ ans, max(x / v1, (n - x) / v2) + t1, max((n - x) / v1, x / v2) + t1 });
    x = (2 * n * v1 + p1 * v2 - p2 * v1) / (v1 + 2 * v2);
    x2 = (n * v1 + p2 * v1 - p1 * v2) / (2 * v1 + v2);
    ans = min({ ans, (n + p2 - 2 * x2) / v2, (2 * x - p1) / v1 });
    cout<<setiosflags(ios::fixed)<<setprecision(10) << ans << endl;
}

signed main() {
    ios::sync_with_stdio(false), cin.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}
/*
10
3 1
da/ma/ca/k
da/ma/ca/m
a/b/cc
da/ma/h/c
3 1
da/ma/ca/k
da/ma/ca/m
a/b/cc
da/ma/c
*/

详细

Test #1:

score: 100
Accepted
time: 1ms
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: 1ms
memory: 3716kb

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: 1ms
memory: 3944kb

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: -100
Wrong Answer
time: 1ms
memory: 3864kb

input:

1
10.0 8.0 0.1 9.0 10

output:

0.0000000000

result:

wrong answer 1st numbers differ - expected: '1.1000000', found: '0.0000000', error = '1.0000000'