結果

問題 No.859 路線A、路線B、路線C
ユーザー yuruhiyayuruhiya
提出日時 2019-08-09 22:41:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 596 ms
コンパイル使用メモリ 72,228 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-26 20:55:43
合計ジャッジ時間 1,375 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,376 KB
testcase_12 AC 2 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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, int 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) : (int)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;
}
0