結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 00:58:15 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 359 bytes |
| コンパイル時間 | 189 ms |
| コンパイル使用メモリ | 82,368 KB |
| 実行使用メモリ | 54,236 KB |
| 最終ジャッジ日時 | 2025-04-16 00:59:13 |
| 合計ジャッジ時間 | 1,990 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / 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))
lam6er