#include //#include //#include //#include #define rep(i, a) for (int i = (int)0; i < (int)a; ++i) #define rrep(i, a) for (int i = (int)a - 1; i >= 0; --i) #define REP(i, a, b) for (int i = (int)a; i < (int)b; ++i) #define RREP(i, a, b) for (int i = (int)a - 1; i >= b; --i) #define repl(i, a) for (ll i = (ll)0; i < (ll)a; ++i) #define pb push_back #define eb emplace_back #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define popcount __builtin_popcount #define fi first #define se second using ll = long long; constexpr ll mod = 1e9 + 7; constexpr ll mod_998244353 = 998244353; constexpr ll INF = 1LL << 60; // #pragma GCC target("avx2") // #pragma GCC optimize("O3") // #pragma GCC optimize("unroll-loops") //using lll=boost::multiprecision::cpp_int; //using Double=boost::multiprecision::number>;//仮数部が1024桁 template inline bool chmin(T &a, T b) { if (a > b) { a = b; return true; } return false; } template inline bool chmax(T &a, T b) { if (a < b) { a = b; return true; } return false; } template T mypow(T x, T n, const T &p = -1) { //x^nをmodで割った余り if (p != -1) { x %= p; } T ret = 1; while (n > 0) { if (n & 1) { if (p != -1) ret = (ret * x) % p; else ret *= x; } if (p != -1) x = (x * x) % p; else x *= x; n >>= 1; } return ret; } using namespace std; //using namespace atcoder; void solve() { int n; double w; cin>>n>>w; vectorx(n),y(n),r(n),v(n),a(n); rep(i,n)cin>>x[i]>>y[i]>>r[i]>>v[i]>>a[i]; auto dis=[](pair p,pair q)->double{ return (p.first-q.first)*(p.first-q.first)+(p.second-q.second)*(p.second-q.second); }; auto calc=[](double t,double x,double y,double r,double v,double a)->pair{ double pi=acos(-1); return {x+r*cos((v*t+a)*pi/180),y+r*sin((v*t+a)*pi/180)}; }; constexpr double inf=1e9; vector>dp((1<(n+1,inf)); dp[0][n]=0;//nは座標(0,0) rep(bit,1< pre_pos={0,0}; if(j!=n)pre_pos=calc(pre_t,x[j],y[j],r[j],v[j],a[j]); double t=0; double left=pre_t,right=1e3; rep(cnt,500){ double mid=(left+right)/2; auto cur_pos=calc(mid,x[k],y[k],r[k],v[k],a[k]); if(dis(pre_pos,cur_pos)<=w*w*(mid-pre_t)*(mid-pre_t))right=mid; else left=mid; } t=right; chmin(dp[bit|1<