QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#236461 | #7184. Transport Pluses | viniciuslettieri# | WA | 0ms | 3844kb | C++20 | 2.1kb | 2023-11-03 23:37:22 | 2023-11-03 23:37:22 |
Judging History
answer
#include<bits/stdc++.h>
int main() {
using namespace std;
cin.tie(nullptr)->sync_with_stdio(false);
int N, T; cin >> N >> T;
int x0, x1, y0, y1; cin >> x0 >> y0 >> x1 >> y1;
vector<int> X(N), Y(N);
for (int i = 0; i < N; i++) cin >> X[i] >> Y[i];
double ans = sqrt(1.0 * (x1-x0) * (x1-x0) + (y1-y0) * (y1-y0));
vector<array<int, 3>> path = {{0, x0, y0}};
for (int i = 0; i < N; i++) {
for (int j = 0; j < N; j++) {
if (i != j) {
int dist = 2 * T + min(abs(x1-X[i]), abs(y1 - Y[i])) + min(abs(x0 - X[j]), abs(y0 - Y[j]));
if (dist < ans) {
ans = dist;
vector<array<int, 3>> cur_path;
if (abs(x0 - X[j]) < abs(y0 - Y[j])) cur_path.push_back({j+1, X[j], y0});
else cur_path.push_back({j+1, x0, Y[j]});
cur_path.push_back({i+1, X[i], Y[j]});
if (abs(x1 - X[i]) < abs(y1 - Y[i])) cur_path.push_back({0, X[i], y1});
else cur_path.push_back({0, x1, Y[i]});
cur_path.push_back({0, x0, y0});
path = cur_path;
}
} else {
int dist = T + min(abs(x1 - Y[i]), abs(y1 - Y[i]))+ min(abs(x0 - X[i]), abs(y0 - Y[i]));
if (ans > dist) {
ans = dist;
vector<array<int, 3>> cur_path;
if (abs(x0 - X[i]) < abs(y0 - Y[i])) cur_path.push_back({i+1, X[i], y0});
else cur_path.push_back({i+1, x0, Y[i]});
if (abs(x1 - X[i]) < abs(y1 - Y[i])) cur_path.push_back({0, X[i], y1});
else cur_path.push_back({0, x1, Y[i]});
cur_path.push_back({0, x0, y0});
path = cur_path;
}
}
}
}
cout << fixed << setprecision(8) << ans << '\n';
cout << int(path.size()) << '\n';
for (const auto [x, y, z] : path) {
cout << x << ' ' << y << ' ' << z << '\n';
}
}
详细
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3844kb
input:
1 2 1 1 5 3 6 2
output:
4.00000000 3 1 1 2 0 5 2 0 1 1
result:
wrong answer step 1: source (1.000000, 1.000000) not on plus (6.000000, 2.000000)