結果

問題 No.1413 Dynamic Sushi
ユーザー mkawa2mkawa2
提出日時 2024-06-16 22:22:06
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 575 ms / 4,000 ms
コード長 1,649 bytes
コンパイル時間 485 ms
コンパイル使用メモリ 82,792 KB
実行使用メモリ 80,092 KB
最終ジャッジ日時 2024-06-16 22:22:20
合計ジャッジ時間 13,110 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
54,440 KB
testcase_01 AC 339 ms
78,676 KB
testcase_02 AC 38 ms
53,780 KB
testcase_03 AC 39 ms
53,200 KB
testcase_04 AC 534 ms
79,964 KB
testcase_05 AC 511 ms
79,700 KB
testcase_06 AC 546 ms
79,940 KB
testcase_07 AC 521 ms
79,968 KB
testcase_08 AC 546 ms
79,964 KB
testcase_09 AC 521 ms
79,720 KB
testcase_10 AC 527 ms
80,036 KB
testcase_11 AC 553 ms
79,816 KB
testcase_12 AC 538 ms
79,960 KB
testcase_13 AC 559 ms
79,936 KB
testcase_14 AC 541 ms
80,092 KB
testcase_15 AC 575 ms
80,068 KB
testcase_16 AC 522 ms
79,960 KB
testcase_17 AC 567 ms
79,836 KB
testcase_18 AC 556 ms
79,932 KB
testcase_19 AC 551 ms
79,944 KB
testcase_20 AC 274 ms
78,208 KB
testcase_21 AC 69 ms
71,384 KB
testcase_22 AC 484 ms
80,072 KB
testcase_23 AC 548 ms
79,840 KB
testcase_24 AC 520 ms
80,008 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

# sys.setrecursionlimit(1000006)
# sys.set_int_max_str_digits(200005)
int1 = lambda x: int(x)-1
pDB = lambda *x: print(*x, end="\n", file=sys.stderr)
p2D = lambda x: print(*x, sep="\n", end="\n\n", file=sys.stderr)
def II(): return int(sys.stdin.readline())
def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(rows_number): return [LI() for _ in range(rows_number)]
def LI1(): return list(map(int1, sys.stdin.readline().split()))
def LLI1(rows_number): return [LI1() for _ in range(rows_number)]
def SI(): return sys.stdin.readline().rstrip()

dij = [(0, 1), (-1, 0), (0, -1), (1, 0)]
# dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)]
# inf = -1-(-1 << 31)
inf = -1-(-1 << 62)

# md = 10**9+7
md = 998244353

from math import sin,cos,radians

def ok(m):
    t=m+pre
    p=x+R*cos(radians(v*t+a))
    q=y+R*sin(radians(v*t+a))
    return (cx-p)**2+(cy-q)**2<=(m*w)**2

n,w=LI()
xa=LLI(n)

dp=[[inf]*n for _ in range(1<<n)]
pos=[[(0,0)]*n for _ in range(1<<n)]
dp[0][0]=0
for s in range(1<<n):
    for i in range(n):
        pre=dp[s][i]
        if pre==inf:continue
        cx,cy=pos[s][i]
        for j in range(n):
            if s>>j&1:continue
            x,y,R,v,a=xa[j]
            ns=s|1<<j
            l,r=0,500
            for _ in range(40):
                m=(l+r)/2
                if ok(m):
                    r=m
                else:
                    l=m
            t=pre+l
            if t<dp[ns][j]:
                dp[ns][j]=t
                p = x+R*cos(radians(v*t+a))
                q = y+R*sin(radians(v*t+a))
                pos[ns][j]=(p,q)

print(min(dp[-1]))
0