样例全过,但是 AC26,WA48
#include <bits/stdc++.h>
using namespace std;
long double n, s, t;
long double ans = 1e9;
bool vis[10];
struct node {
long double sx, sy, ex, ey;
} a[10];
inline void dfs(int step, long double res, long double x, long double y) {
if (step == n + 1) {
ans = min(ans, res);
return;
}
for (int i = 1; i <= n; i++) {
if (!vis[i]) {
vis[i] = 1;
long double tt = sqrt((x - a[i].sx) * (x - a[i].sx) + (y - a[i].sy) * (y - a[i].sy)) / s;
long double t2 = sqrt((x - a[i].ex) * (x - a[i].ex) + (y - a[i].ey) * (y - a[i].ey)) / s;
long double t3 = sqrt((a[i].sx - a[i].ex) * (a[i].sx - a[i].ex) + (a[i].sy - a[i].ey) * (a[i].sy - a[i].ey)) / t;
if (t < t2) {
dfs(step + 1, res + tt + t3, a[i].ex, a[i].ey);
} else {
dfs(step + 1, res + t2 + t3, a[i].sx, a[i].sy);
}
vis[i] = 0;
}
}
}
signed main() {
ios::sync_with_stdio(false);
ios_base::sync_with_stdio(false);
cin.tie(0), cout.tie(0);
cin >> n >> s >> t;
for (int i = 1; i <= n; i++) {
cin >> a[i].sx >> a[i].sy >> a[i].ex >>a[i].ey;
}
dfs(1, 0, 0, 0);
printf("%.12Lf", ans);
return 0;
}