結果

問題 No.1413 Dynamic Sushi
ユーザー ygd.ygd.
提出日時 2021-03-04 00:00:16
言語 PyPy3
(7.3.15)
結果
MLE  
実行時間 -
コード長 1,326 bytes
コンパイル時間 178 ms
コンパイル使用メモリ 82,396 KB
実行使用メモリ 847,568 KB
最終ジャッジ日時 2024-04-14 15:34:56
合計ジャッジ時間 4,712 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
54,304 KB
testcase_01 AC 38 ms
54,212 KB
testcase_02 AC 39 ms
52,852 KB
testcase_03 AC 39 ms
54,684 KB
testcase_04 MLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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)
0