結果

問題 No.859 路線A、路線B、路線C
ユーザー akitsugu777akitsugu777
提出日時 2019-09-02 13:13:12
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 16 ms / 1,000 ms
コード長 765 bytes
コンパイル時間 84 ms
コンパイル使用メモリ 11,076 KB
実行使用メモリ 8,392 KB
最終ジャッジ日時 2023-08-21 14:56:07
合計ジャッジ時間 1,557 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,932 KB
testcase_01 AC 15 ms
8,324 KB
testcase_02 AC 16 ms
8,340 KB
testcase_03 AC 15 ms
8,212 KB
testcase_04 AC 15 ms
8,320 KB
testcase_05 AC 15 ms
8,244 KB
testcase_06 AC 15 ms
8,344 KB
testcase_07 AC 15 ms
8,268 KB
testcase_08 AC 15 ms
8,184 KB
testcase_09 AC 15 ms
8,224 KB
testcase_10 AC 16 ms
7,764 KB
testcase_11 AC 16 ms
8,212 KB
testcase_12 AC 16 ms
8,332 KB
testcase_13 AC 15 ms
8,392 KB
testcase_14 AC 15 ms
8,212 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

a, b, c = map(int,input().split())
S = input().split()
s = int(S[1])
G = input().split()
g = int(G[1])

l = []
if S[0] == G[0]:
    if s > g:
        s, g = g, s
    if S[0] == 'B':
        a, b, c = b, a, c
    elif S[0] == 'C':
        a, b, c = c, b, a
    l.append(g-s)
    l.append(s+c+(a-g))
    l.append(s+b+(a-g))

else:
    if S[0] == 'A' and G[0] == 'B':
        a, b, c = a, c, b
    elif S[0] == 'B' and G[0] == 'A':
        a, b, c = b, c, a
    elif S[0] == 'B' and G[0] == 'C':
        a, b, c = b, a, c
    elif S[0] == 'C' and G[0] == 'A':
        a, b, c = c, b, a
    elif S[0] == 'C' and G[0] == 'B':
        a, b, c = c, a, b
    l.append((s+g-1))
    l.append(((a-s)+(c-g)+1))
    l.append(((a-s)+b+g))
    l.append((s+b+(c-g)))

print(min(l))
0