QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#211609 | #7184. Transport Pluses | jean | WA | 0ms | 3996kb | C++14 | 2.6kb | 2023-10-12 19:19:09 | 2023-10-12 19:19:10 |
Judging History
answer
#include"bits/stdc++.h"
using namespace std;
const int N = 1e3 + 10;
int n, t;
struct node {
double x, y;
}p[N], h, e;
double dis(node a, node b) {
return sqrt((a.x - b.x) * (a.x - b.x) + (a.y - b.y) * (a.y - b.y));
}
double dist[N][N];
void solve() {
cin >> n >> t;
cin >> h.x >> h.y;
cin >> e.x >> e.y;
for(int i = 1; i <= n; i++) {
cin >> p[i].x >> p[i].y;
}
double ans = dis(h, e);
for(int i = 1; i <= n; i++) {
double now = min(abs(p[i].x - h.x), abs(p[i].y - h.y));
now += min(abs(p[i].x - e.x), abs(p[i].y - e.y));
now += t;
ans = min(ans, now);
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n; j++) {
if(i == j) continue;
double now = min(abs(p[i].x - h.x), abs(p[i].y - h.y));
now += min(abs(p[j].x - e.x), abs(p[j].y - e.y));
now += 2 * t;
ans = min(ans, now);
}
}
cout << ans << "\n";
if(ans == dis(h, e)) {
cout << 0 << " " << e.x << " " << e.y << "\n";
return;
}
for(int i = 1; i <= n; i++) {
double now = min(abs(p[i].x - h.x), abs(p[i].y - h.y));
now += min(abs(p[i].x - e.x), abs(p[i].y - e.y));
now += t;
if(ans == now) {
cout << 3 << "\n";
if(abs(p[i].x - h.x) < abs(p[i].y - h.y)) cout << 0 << " " << p[i].y << " " << h.y << "\n";
else cout << 0 << " " << h.x << " " << p[i].y << "\n";
if(abs(p[i].x - e.x) < abs(p[i].y - e.y)) {
cout << i << " " << p[i].x << " " << e.y << "\n";
cout << 0 << " " << e.x << " " << e.y << "\n";
}
else{
cout << i << " " << e.x << " " << p[i].y << "\n";
cout << 0 << " " << e.x << " " << e.y << "\n";
}
return ;
}
}
for(int i = 1; i <= n; i++) {
for(int j = 1; j <= n; j++) {
if(i == j) continue;
double now = min(abs(p[i].x - h.x), abs(p[i].y - h.y));
now += min(abs(p[j].x - e.x), abs(p[j].y - e.y));
now += 2 * t;
if(now == ans) {
cout << 4 << "\n";
if(abs(p[i].x - h.x) > abs(p[i].y - h.y)) {
cout << 0 << " " << h.x << " " << p[i].y << "\n";
cout << i << " " << p[i].x << " " << p[j].y << "\n";
}
else {
cout << 0 << " " << p[i].x << " " << h.y << "\n";
cout << i << " " << p[i].x << " " << p[j].y << "\n";
}
if(abs(p[j].x - e.x) < abs(p[j].y - e.y)) {
cout << j << " " << p[j].x << " " << e.y << "\n";
cout << 0 << " " << e.x << " " << e.y << "\n";
}
else {
cout << j << " " << e.x << " " << p[j].y << "\n";
cout << 0 << " " << e.x << " " << e.y << "\n";
}
return ;
}
}
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0), cout.tie(0);
solve();
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3888kb
input:
1 2 1 1 5 3 6 2
output:
4 3 0 1 2 1 5 2 0 5 3
result:
ok correct
Test #2:
score: 0
Accepted
time: 0ms
memory: 3880kb
input:
2 1 1 1 6 1 1 3 6 3
output:
2 4 0 1 1 1 1 3 2 6 1 0 6 1
result:
ok correct
Test #3:
score: -100
Wrong Answer
time: 0ms
memory: 3996kb
input:
0 0 1 1 1 1
output:
0 0 1 1
result:
wrong output format Extra information in the output file