結果
| 問題 |
No.126 2基のエレベータ
|
| コンテスト | |
| ユーザー |
gew1fw
|
| 提出日時 | 2025-06-12 14:18:13 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 383 bytes |
| コンパイル時間 | 398 ms |
| コンパイル使用メモリ | 82,176 KB |
| 実行使用メモリ | 52,224 KB |
| 最終ジャッジ日時 | 2025-06-12 14:18:16 |
| 合計ジャッジ時間 | 2,693 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 8 |
ソースコード
A, B, S = map(int, input().split())
# Scenario 1: Use A directly
scenario1 = abs(A - S) + S
# Scenario 2: Use B first, then A
min_scenario2 = float('inf')
for F in range(1, 101):
sum_moves = abs(B - S) + abs(F - S) + abs(A - F) + F
if sum_moves < min_scenario2:
min_scenario2 = sum_moves
# The minimal total moves
total = min(scenario1, min_scenario2)
print(total)
gew1fw