結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
lam6er
|
| 提出日時 | 2025-04-16 00:59:28 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 359 bytes |
| コンパイル時間 | 349 ms |
| コンパイル使用メモリ | 81,848 KB |
| 実行使用メモリ | 53,348 KB |
| 最終ジャッジ日時 | 2025-04-16 01:00:42 |
| 合計ジャッジ時間 | 2,129 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| 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