結果

問題 No.126 2基のエレベータ
ユーザー GOTKAKO
提出日時 2025-07-12 20:20:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 389 bytes
コンパイル時間 1,961 ms
コンパイル使用メモリ 194,744 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-07-12 20:20:47
合計ジャッジ時間 3,122 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2 WA * 1
other AC * 25 WA * 2
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);

    int a,b,s; cin >> a >> b >> s;
    if(abs(a-s) <= abs(b-s)) cout << abs(a-s)+s << endl;
    else if(s > 1){
        cout << min(abs(b-s)+s-1+a,abs(b-s)+abs(s-a)+a) << endl;
    }    
    else if(s == 1) cout << a << endl; 
    else cout << abs(b-s)+s-1+2 << endl;
}
0