結果

問題 No.134 走れ!サブロー君
ユーザー convexineqconvexineq
提出日時 2021-01-18 04:34:34
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 680 bytes
コンパイル時間 523 ms
コンパイル使用メモリ 87,176 KB
実行使用メモリ 81,180 KB
最終ジャッジ日時 2023-08-20 10:58:27
合計ジャッジ時間 3,447 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 72 ms
71,284 KB
testcase_01 AC 99 ms
76,196 KB
testcase_02 RE -
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 RE -
testcase_07 RE -
testcase_08 RE -
testcase_09 AC 203 ms
81,180 KB
testcase_10 AC 72 ms
71,376 KB
testcase_11 AC 70 ms
71,284 KB
testcase_12 AC 70 ms
71,372 KB
testcase_13 AC 72 ms
71,264 KB
testcase_14 AC 70 ms
71,516 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

x,y = map(int,input().split())
n = int(input())+1
N = 1<<n
X = [0]*n
Y = [0]*n
W = [0]*N
X[0],Y[0] = x,y
for i in range(1,n):
    X[i],Y[i],w = map(int,input().split())
    for j in range(1<<i):
        W[j+(1<<i)] = W[j] + w

def d(i,j,w):
    return (abs(X[i]-X[j])+abs(Y[i]-Y[j]))/120*(w+100)

INF = 1e9
dp = [[INF]*n for _ in range(N)] # 残り配達、最後の地点
dp[N-1][0] = 0.0
for mask in range(N-1,-1,-1):
    for i in range(n):
        for j in range(n):
            if i==j: continue
            if mask>>j&1 == 0: continue
            nmask = mask^(1<<j)
            dp[nmask][j] = min(dp[nmask][j],dp[mask][i] + d(i,j,W[mask]) + W[mask]-W[nmask])
print(dp[0][0])
0