結果
| 問題 | 
                            No.126 2基のエレベータ
                             | 
                    
| コンテスト | |
| ユーザー | 
                             lam6er
                         | 
                    
| 提出日時 | 2025-04-16 01:00:56 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 359 bytes | 
| コンパイル時間 | 559 ms | 
| コンパイル使用メモリ | 81,824 KB | 
| 実行使用メモリ | 53,304 KB | 
| 最終ジャッジ日時 | 2025-04-16 01:02:23 | 
| 合計ジャッジ時間 | 1,956 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 19 WA * 8 | 
ソースコード
A, B, S = map(int, input().split())
# Scenario 1: Directly use elevator A
cost1 = abs(A - S) + S  # A moves to S, then to 0
# Scenario 2: Use B to X, then A to 0
min_sum = float('inf')
for x in range(1, 101):
    current = abs(S - x) + abs(A - x) + x
    if current < min_sum:
        min_sum = current
cost2 = abs(B - S) + min_sum
print(min(cost1, cost2))
            
            
            
        
            
lam6er