結果
| 問題 |
No.1413 Dynamic Sushi
|
| コンテスト | |
| ユーザー |
ygd.
|
| 提出日時 | 2021-03-04 00:00:16 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
MLE
|
| 実行時間 | - |
| コード長 | 1,326 bytes |
| コンパイル時間 | 394 ms |
| コンパイル使用メモリ | 82,384 KB |
| 実行使用メモリ | 847,572 KB |
| 最終ジャッジ日時 | 2024-10-03 15:22:17 |
| 合計ジャッジ時間 | 4,351 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 4 MLE * 1 -- * 20 |
ソースコード
import math
import itertools
N,W = map(int,input().split())
X=[];Y=[];R=[];V=[];A=[];S =set([])
for _ in range(N):
x,y,r,v,a = map(int,input().split())
if (x,y,r,v,a) in S:
continue
X.append(x);Y.append(y);R.append(r);V.append(v);A.append(a)
S.add((x,y,r,v,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
N = len(S)
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)
ygd.