結果
問題 |
No.126 2基のエレベータ
|
ユーザー |
![]() |
提出日時 | 2020-02-02 22:00:45 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 426 bytes |
コンパイル時間 | 82 ms |
コンパイル使用メモリ | 12,416 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-18 21:27:52 |
合計ジャッジ時間 | 1,968 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 WA * 1 |
ソースコード
import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines A,B,S = map(int,read().split()) def f(A,B,S): if abs(A-S) <= abs(B-S): return abs(A-S) + abs(S) x = abs(B-S) + abs(S-1) + abs(A-1) + 1 if A == 0: return x y = abs(B-S) + abs(S-A) + abs(A) return min(x,y) # f(5,10,7), f(10,50,30), f(0,1,1) answer = f(A,B,S) print(answer)