結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 16:41:34 |
| 言語 | PyPy3 (7.3.17) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 359 bytes |
| 記録 | |
| コンパイル時間 | 235 ms |
| コンパイル使用メモリ | 95,980 KB |
| 実行使用メモリ | 78,848 KB |
| 最終ジャッジ日時 | 2026-07-09 16:15:49 |
| 合計ジャッジ時間 | 3,243 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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