結果
| 問題 | No.126 2基のエレベータ |
| コンテスト | |
| ユーザー |
h_noson
|
| 提出日時 | 2016-02-16 20:08:57 |
| 言語 | C++11 (gcc 15.3.0 + boost 1.92.0) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 5,000 ms |
| + 404µs | |
| コード長 | 462 bytes |
| 記録 | |
| コンパイル時間 | 289 ms |
| コンパイル使用メモリ | 72,960 KB |
| 実行使用メモリ | 6,528 KB |
| 最終ジャッジ日時 | 2026-09-13 08:52:31 |
| 合計ジャッジ時間 | 2,210 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 27 |
ソースコード
#include <iostream>
#include <vector>
using namespace std;
#define REP(i,s,e) for (int i = s; i < e; i++)
#define rep(i,n) REP(i,0,n)
int main() {
int a, b, s, ans;
cin >> a >> b >> s;
int da = abs(s - a);
int db = abs(s - b);
if (da <= db)
ans = da + s;
else if (a == 0)
ans = db + (s-1) + 2;
else if (s == 1)
ans = a;
else
ans = db + min(da,s-1) + a;
cout << ans << endl;
return 0;
}
h_noson