結果
| 問題 |
No.859 路線A、路線B、路線C
|
| コンテスト | |
| ユーザー |
Nagisa
|
| 提出日時 | 2019-08-09 23:49:08 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 667 bytes |
| コンパイル時間 | 378 ms |
| コンパイル使用メモリ | 82,304 KB |
| 実行使用メモリ | 52,480 KB |
| 最終ジャッジ日時 | 2024-07-19 16:00:05 |
| 合計ジャッジ時間 | 1,937 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 1 |
ソースコード
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))
Nagisa