結果
問題 |
No.1413 Dynamic Sushi
|
ユーザー |
![]() |
提出日時 | 2021-03-03 23:56:49 |
言語 | PyPy3 (7.3.15) |
結果 |
MLE
|
実行時間 | - |
コード長 | 1,240 bytes |
コンパイル時間 | 497 ms |
コンパイル使用メモリ | 82,304 KB |
実行使用メモリ | 851,436 KB |
最終ジャッジ日時 | 2024-10-03 15:17:25 |
合計ジャッジ時間 | 5,837 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 1 MLE * 1 -- * 23 |
ソースコード
import math import itertools N,W = map(int,input().split()) X=[];Y=[];R=[];V=[];A=[] for _ in range(N): x,y,r,v,a = map(int,input().split()) X.append(x);Y.append(y);R.append(r);V.append(v);A.append(a) #print(X,Y) def touch(p,q,t,i): #今(p,q)に時間tでいてi番目の寿司を手に入れるのにかかる時間と最後の座標 x = X[i]; y = Y[i]; r = R[i]; v = V[i]; a = A[i] sx = x + r*math.cos(math.radians(v*t+a)) sy = y + r*math.sin(math.radians(v*t+a)) if (p,q) == (sx,sy): return p,q,t ng = 0 ok = 1000 E = pow(10,-10) while abs(ok-ng) > E: mid = (ok+ng)/2 mx = x + r*math.cos(math.radians(v*(t+mid)+a)) my = y + r*math.sin(math.radians(v*(t+mid)+a)) dis2 = pow(mx-p,2) + pow(my-q,2) if dis2 <= (mid*W)**2: ok = mid else: ng = mid nt = t + ok np = x + r*math.cos(math.radians(v*nt+a)) nq = y + r*math.sin(math.radians(v*nt+a)) return np, nq, nt B = [i for i in range(N)] Order = list(itertools.permutations(B,N)) ans = 1<<60 for L in Order: x0 = 0; y0 = 0; t = 0 #原点スタート for i in L: x0, y0, t = touch(x0,y0,t,i) #print(t,X) ans = min(ans,t) print(ans)