結果
| 問題 |
No.859 路線A、路線B、路線C
|
| コンテスト | |
| ユーザー |
yuruhiya
|
| 提出日時 | 2019-08-09 22:44:05 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 1,000 ms |
| コード長 | 580 bytes |
| コンパイル時間 | 591 ms |
| コンパイル使用メモリ | 72,748 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-07-19 14:49:11 |
| 合計ジャッジ時間 | 1,098 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
vector<int> x(3);
cin >> x[0] >> x[1] >> x[2];
char S0, S1; int t0, t1;
cin >> S0 >> t0 >> S1 >> t1;
auto Inter = [=](bool i, char S, long long t) {
return i ? t : x[S - 'A'] - t + 1;
};
int Xmin = min({ x[0],x[1],x[2] }) - 1;
cout << min({
S0 == S1 ? abs(t0 - t1) : (long long)2e9,
Inter(1, S0, t0) + Inter(1, S1, t1) - 1, Inter(0, S0, t0) + Inter(0, S1, t1) - 1,
Inter(1, S0, t0) + Xmin + Inter(0, S1, t1), Inter(0, S0, t0) + Xmin + Inter(2, S1, t1),
}) << endl;
}
yuruhiya