結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
baku1101
|
| 提出日時 | 2018-09-04 16:12:09 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,317 bytes |
| コンパイル時間 | 1,498 ms |
| コンパイル使用メモリ | 165,104 KB |
| 実行使用メモリ | 5,248 KB |
| 最終ジャッジ日時 | 2024-10-14 13:46:39 |
| 合計ジャッジ時間 | 2,566 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 19 WA * 8 |
ソースコード
//include
//------------------------------------------
#include <bits/stdc++.h>
using namespace std;
//typedef
//------------------------------------------
typedef long long LL;
typedef vector<LL> VL;
typedef vector<VL> VVL;
typedef vector<string> VS;
typedef pair<LL, LL> PLL;
//container util
//------------------------------------------
#define ALL(a) (a).begin(),(a).end()
#define RALL(a) (a).rbegin(), (a).rend()
#define PB push_back
#define MP make_pair
#define SZ(a) int((a).size())
#define EACH(i,c) for(typeof((c).begin()) i=(c).begin(); i!=(c).end(); ++i)
#define EXIST(s,e) ((s).find(e)!=(s).end())
#define SORT(c) sort((c).begin(),(c).end())
//constant
//--------------------------------------------
const double EPS = 1e-10;
const double PI = acos(-1.0);
const int MOD = 1000000007;
//debug
#define dump(x) cerr << #x << " = " << (x) << endl;
#define debug(x) cerr << #x << " = " << (x) << " (L" << __LINE__ << ")" << " " << __FILE__ << endl;
//main code
int main(int argc, char const* argv[])
{
int a,b,s;
cin >> a >> b >> s;
if (s == 1) {
cout << abs(a - s) + s << endl;
return 0;
}
if (abs(s - b) < abs(s - a)) {
cout << abs(s - b) + min(abs(s - a) + a,s + a) << endl;
}
else {
cout << abs(s - a) + s << endl;
}
return 0;
}
baku1101