結果
問題 | No.126 2基のエレベータ |
ユーザー |
![]() |
提出日時 | 2025-03-20 21:01:48 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 558 bytes |
コンパイル時間 | 138 ms |
コンパイル使用メモリ | 82,548 KB |
実行使用メモリ | 54,204 KB |
最終ジャッジ日時 | 2025-03-20 21:01:51 |
合計ジャッジ時間 | 2,224 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 13 WA * 14 |
ソースコード
A, B, S = map(int, input().split())min_total = float('inf')if S == 1:# Case 1: Press down button (only A can come)total_case1 = abs(S - A) + Smin_total = min(min_total, total_case1)# Case 2: Press up button (normal condition)a_dist = abs(S - A)b_dist = abs(S - B)if a_dist <= b_dist:total_case2 = a_dist + Smin_total = min(min_total, total_case2)else:a_dist = abs(S - A)b_dist = abs(S - B)if a_dist <= b_dist:total = a_dist + Smin_total = totalprint(min_total)