結果
問題 | No.859 路線A、路線B、路線C |
ユーザー | tktk_snsn |
提出日時 | 2021-01-23 11:13:03 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 716 bytes |
コンパイル時間 | 383 ms |
コンパイル使用メモリ | 87,108 KB |
実行使用メモリ | 71,520 KB |
最終ジャッジ日時 | 2023-08-28 20:49:42 |
合計ジャッジ時間 | 2,645 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 68 ms
71,448 KB |
testcase_01 | AC | 66 ms
71,160 KB |
testcase_02 | AC | 69 ms
71,228 KB |
testcase_03 | AC | 68 ms
71,164 KB |
testcase_04 | AC | 68 ms
71,228 KB |
testcase_05 | AC | 67 ms
71,088 KB |
testcase_06 | AC | 68 ms
71,296 KB |
testcase_07 | AC | 68 ms
71,272 KB |
testcase_08 | AC | 68 ms
71,080 KB |
testcase_09 | AC | 70 ms
71,488 KB |
testcase_10 | AC | 67 ms
71,108 KB |
testcase_11 | AC | 69 ms
71,160 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
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: print(abs(x - y)) else: 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])