結果
問題 | No.859 路線A、路線B、路線C |
ユーザー | tktk_snsn |
提出日時 | 2021-01-23 11:16:26 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 69 ms / 1,000 ms |
コード長 | 670 bytes |
コンパイル時間 | 514 ms |
コンパイル使用メモリ | 87,124 KB |
実行使用メモリ | 71,520 KB |
最終ジャッジ日時 | 2023-08-28 20:53:59 |
合計ジャッジ時間 | 2,618 ms |
ジャッジサーバーID (参考情報) |
judge15 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
71,092 KB |
testcase_01 | AC | 69 ms
71,064 KB |
testcase_02 | AC | 68 ms
71,292 KB |
testcase_03 | AC | 68 ms
71,296 KB |
testcase_04 | AC | 68 ms
71,368 KB |
testcase_05 | AC | 68 ms
71,348 KB |
testcase_06 | AC | 68 ms
71,304 KB |
testcase_07 | AC | 68 ms
71,252 KB |
testcase_08 | AC | 69 ms
71,332 KB |
testcase_09 | AC | 69 ms
71,080 KB |
testcase_10 | AC | 69 ms
71,420 KB |
testcase_11 | AC | 68 ms
71,276 KB |
testcase_12 | AC | 68 ms
71,268 KB |
testcase_13 | AC | 68 ms
71,496 KB |
testcase_14 | AC | 68 ms
71,520 KB |
ソースコード
inf = float("inf") G = [[inf] * 8 for _ in range(8)] # a0,ax,b0,by,c0,cz,s,t xyz = list(map(int, input().split())) for i in range(3): G[2*i][2*i+1] = G[2*i+1][2*i] = xyz[i] - 1 for j in range(3): if i != j: G[2*i][2*j] = 1 G[2*i+1][2*j+1] = 1 s, x = input().split() t, y = input().split() d = {"A": 0, "B": 1, "C": 2} x = int(x) - 1 y = int(y) - 1 if s == t: G[6][7] = abs(x - y) i = d[s] G[6][2*i] = x G[6][2*i+1] = xyz[i] - x - 1 i = d[t] G[2*i][7] = y G[2*i+1][7] = xyz[i] - y - 1 for k in range(8): for i in range(8): for j in range(8): G[i][j] = min(G[i][j], G[i][k] + G[k][j]) print(G[6][7])