#line 1 "/home/siro53/kyo-pro/compro_library/template/template.cpp" #include using namespace std; template inline bool chmax(T &a, T b) { if(a < b) { a = b; return 1; } return 0; } template inline bool chmin(T &a, T b) { if(a > b) { a = b; return 1; } return 0; } #define DEBUG #ifdef DEBUG template ostream &operator<<(ostream &os, const pair &p) { os << '(' << p.first << ',' << p.second << ')'; return os; } template ostream &operator<<(ostream &os, const vector &v) { os << '{'; for(int i = 0; i < (int)v.size(); i++) { if(i) { os << ','; } os << v[i]; } os << '}'; return os; } void debugg() { cerr << endl; } template void debugg(const T &x, const Args &... args) { cerr << " " << x; debugg(args...); } #define debug(...) \ cerr << __LINE__ << " [" << #__VA_ARGS__ << "]: ", debugg(__VA_ARGS__) #define dump(x) cerr << __LINE__ << " " << #x << " = " << (x) << endl #else #define debug(...) (void(0)) #define dump(x) (void(0)) #endif struct Setup { Setup() { cin.tie(0); ios::sync_with_stdio(false); cout << fixed << setprecision(15); } } __Setup; using ll = long long; #define ALL(v) (v).begin(), (v).end() #define RALL(v) (v).rbegin(), (v).rend() #define FOR(i, a, b) for(int i = (a); i < int(b); i++) #define REP(i, n) FOR(i, 0, n) const int INF = 1 << 30; const ll LLINF = 1LL << 60; constexpr int MOD = 1000000007; const int dx[4] = {1, 0, -1, 0}; const int dy[4] = {0, 1, 0, -1}; //------------------------------------- #line 2 "b.cpp" using Pd = pair; const double PI = acos(-1); int N, W; int X[20], Y[20], R[20], V[20], A[20]; double dp[1 << 20][20]; // i番目の寿司の時刻tの位置 Pd get_pos(int i, double t) { double x = double(X[i]) + R[i] * cos((V[i] * t + A[i]) * PI / 180.0); double y = double(Y[i]) + R[i] * sin((V[i] * t + A[i]) * PI / 180.0); return Pd(x, y); } // from -> to に速度Wでlimit_time以内で到達できるか bool check(Pd from, Pd to, double limit_time) { double x = from.first - to.first; double y = from.second - to.second; double d = sqrt(x * x + y * y); return (d <= limit_time * W); } int main() { cin >> N >> W; REP(i, N) cin >> X[i] >> Y[i] >> R[i] >> V[i] >> A[i]; // 初期化 REP(S, 1 << N) REP(i, N) dp[S][i] = LLINF; REP(i, N) { double ok = 1e5, ng = 0.0; REP(_, 50) { double mid = (ok + ng) / 2.0; (check(Pd(0, 0), get_pos(i, mid), mid) ? ok : ng) = mid; } dp[1 << i][i] = ok; } REP(S, 1 << N) { REP(i, N) { if((S >> i & 1) == 0) continue; if(dp[S][i] == LLINF) continue; Pd from = get_pos(i, dp[S][i]); REP(j, N) { if(S >> j & 1) continue; double ok = 1e5, ng = 0.0; REP(_, 50) { double mid = (ok + ng) / 2.0; Pd to = get_pos(j, dp[S][i] + mid); (check(from, to, mid) ? ok : ng) = mid; } chmin(dp[S | (1 << j)][j], dp[S][i] + ok); } } } double ans = LLINF; REP(i, N) chmin(ans, dp[(1 << N) - 1][i]); cout << ans << "\n"; }