結果
問題 | No.126 2基のエレベータ |
ユーザー |
👑 |
提出日時 | 2022-01-20 09:59:46 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 303 bytes |
コンパイル時間 | 309 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 51,968 KB |
最終ジャッジ日時 | 2024-11-23 14:26:33 |
合計ジャッジ時間 | 2,321 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 WA * 1 |
other | AC * 27 |
ソースコード
a, b, s = map(int, input().split()) if s == 1: print(a) elif abs(a - s) <= abs(b - s): print(abs(a - s) + s) else: ans = abs(b - s) + s - 1 + abs(a - 1) + 1 if a == 0: ans = min(ans, abs(b - s) + s + 1) else: ans = min(ans, abs(b - s) + abs(a - s) + a) print(ans)