QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#962527 | #6725. Pick Up | SICKO | AC ✓ | 143ms | 4096kb | C++17 | 978b | 2025-04-02 21:11:42 | 2025-04-02 21:11:43 |
Judging History
answer
//
// Created by 35417 on 2025/4/2.
//
#include<bits/stdc++.h>
using namespace std;
#define ld long double
ld get(ld x1, ld y1, ld x2, ld y2, int v) {
return (abs(x1 - x2) + abs(y1 - y2)) / v;
}
void solve() {
ld a, b, x1, x2, x3, y1, y2, y3;
cin >> a >> b >> x1 >> y1 >> x2 >> y2 >> x3 >> y3;
ld res = get(x1, y1, x3, y3, a);
ld l = min(x1, x2), r = max(x1, x2), u = max(y1, y2), d = min(y1, y2);
ld x4 = max(l, min(r, x3)), y4 = max(d, min(u, y3));
if(get(x1, y1, x4, y4, a) < get(x2, y2, x4, y4, b)) {
res = min(res, get(x2, y2, x3, y3, b));
} else {
ld t = get(x1, y1, x2, y2, a+b);
ld dis = abs(x3-x1)+abs(y3-y1) - t*a;
res = min(res, t+dis/b);
}
cout<<fixed<<setprecision(12)<<res<<"\n";
}
signed main() {
ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
int T = 1;
cin >> T;
for (int i = 1; i <= T; i++) solve();
return 0;
}
这程序好像有点Bug,我给组数据试试?
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 4096kb
input:
3 1 2 0 2 1 0 2 2 1 3 1 1 0 1 3 1 1 2 0 0 100 100 1 1
output:
1.500000000000 1.000000000000 2.000000000000
result:
ok 3 numbers
Test #2:
score: 0
Accepted
time: 143ms
memory: 4096kb
input:
100000 158260522 877914575 602436426 24979445 861648772 623690081 433933447 476190629 731963982 822804784 450968417 430302156 982631932 161735902 880895728 923078537 317063340 492686568 773361868 125660016 650287940 839296263 462224593 492601449 576823355 782177068 404011431 818008580 954291757 1604...
output:
1.384607248572 1.178236811488 1.744616740037 0.470199832668 1.370533155904 2.305182945366 1.061124554447 1.061636780305 1.235959085540 2.333837989244 2.000606982282 0.977252836597 0.624150449526 1.185362533409 0.140506254667 0.180122576855 1.226313153310 5.927496595929 5.952019153241 0.495850184038 ...
result:
ok 100000 numbers