結果

問題 No.859 路線A、路線B、路線C
コンテスト
ユーザー Nagisa
提出日時 2019-08-09 23:49:08
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
WA  
実行時間 -
コード長 667 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 307 ms
コンパイル使用メモリ 85,012 KB
実行使用メモリ 138,584 KB
最終ジャッジ日時 2026-04-02 17:19:55
合計ジャッジ時間 1,277 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 1
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

x, y, z = map(int,input().split())
S0, t0 = input().split()
S1, t1 = input().split()
t0, t1 = int(t0), int(t1)

if S0 == S1 == "A":
    print(min(abs(t0-t1),x+y-abs(t0-t1)))
elif S0 == S1 == "B":
    print(min(abs(t0-t1),x+y-abs(t0-t1),y+z-abs(t0-t1)))
elif S0 == S1 == "C":
    print(min(abs(t0-t1),z+y-abs(t0-t1)))
elif (S0 == "A" and S1 == "B") or (S0 == "B" and S1 == "A"):
    print(min(t0+t1-1,x+y-(t0+t1-1)))
elif (S0 == "C" and S1 == "B") or (S0 == "B" and S1 == "C"):
    print(min(t0+t1-1,z+y-(t0+t1-1)))
elif S0 == "A" and S1 == "C":
    print(min(t0+t1-1,z+x-(t0+t1-1),t0+z-t1+y,x-t0+t1+y))
else:
    print(min(t0+t1-1,z+x-(t0+t1-1),t1+z-t0+y,x-t1+t0+y))
0