結果
問題 |
No.126 2基のエレベータ
|
ユーザー |
![]() |
提出日時 | 2025-04-16 16:41:34 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 359 bytes |
コンパイル時間 | 428 ms |
コンパイル使用メモリ | 81,912 KB |
実行使用メモリ | 53,472 KB |
最終ジャッジ日時 | 2025-04-16 16:43:32 |
合計ジャッジ時間 | 2,422 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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))