結果
問題 | No.859 路線A、路線B、路線C |
ユーザー |
![]() |
提出日時 | 2020-12-20 08:51:28 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 928 bytes |
コンパイル時間 | 246 ms |
コンパイル使用メモリ | 82,248 KB |
実行使用メモリ | 54,300 KB |
最終ジャッジ日時 | 2024-09-21 11:34:25 |
合計ジャッジ時間 | 1,443 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 35 ms
53,168 KB |
testcase_01 | AC | 36 ms
52,120 KB |
testcase_02 | AC | 34 ms
53,640 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 34 ms
53,416 KB |
testcase_06 | WA | - |
testcase_07 | AC | 35 ms
53,324 KB |
testcase_08 | WA | - |
testcase_09 | AC | 37 ms
52,656 KB |
testcase_10 | WA | - |
testcase_11 | AC | 35 ms
52,724 KB |
testcase_12 | WA | - |
testcase_13 | AC | 33 ms
52,424 KB |
testcase_14 | WA | - |
ソースコード
import sys sys.setrecursionlimit(10**7) def I(): return int(sys.stdin.readline().rstrip()) def MI(): return map(int,sys.stdin.readline().rstrip().split()) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI2(): return list(map(int,sys.stdin.readline().rstrip())) def S(): return sys.stdin.readline().rstrip() def LS(): return list(sys.stdin.readline().rstrip().split()) def LS2(): return list(sys.stdin.readline().rstrip()) x,y,z = MI() s,t0 = S().split() t0 = int(t0) g,t1 = S().split() t1 = int(t1) if s == g: if t0 > t1: t0,t1 = t1,t0 if s == 'B': y,x = x,y if s == 'C': x,y = y,x ans = min(t1-t0,t0+min(y,z)+(x-t1)) print(ans) else: if s == 'B': x,y = y,x if s == 'C': x,z = z,x if g == 'A': x,y = y,x if g == 'C': y,z = z,y ans = min(t0+t1-1,(x-t0)+(y-t1),t0+z+(y-t1),(x-t0)+z+t1-1) print(ans)