結果
問題 | No.859 路線A、路線B、路線C |
ユーザー |
|
提出日時 | 2022-05-04 13:14:06 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 38 ms / 1,000 ms |
コード長 | 500 bytes |
コンパイル時間 | 237 ms |
コンパイル使用メモリ | 82,444 KB |
実行使用メモリ | 52,480 KB |
最終ジャッジ日時 | 2024-07-03 15:39:45 |
合計ジャッジ時間 | 1,654 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 12 |
ソースコード
ls = list(map(int,input().split())) S0,t0 = input().split() S1,t1 = input().split() l = 'ABC' s = [l.index(S0),int(t0)-1] g = [l.index(S1),int(t1)-1] if s[0] == g[0]: a = ls.pop(s[0]) ans = min(abs(s[1]-g[1]),a-abs(s[1]-g[1])+ls[0],a-abs(s[1]-g[1])+ls[1]) else: ans = min(s[1]+g[1]+1,ls[s[0]]-s[1]-1+ls[g[0]]-g[1]-1+1) aa = set([0,1,2]) aa.remove(s[0]) aa.remove(g[0]) n = list(aa)[0] ans = min(ans,s[1]+ls[g[0]]-g[1]-1+ls[n]+1,g[1]+ls[s[0]]-s[1]-1+ls[n]+1) print(ans)