結果
| 問題 |
No.859 路線A、路線B、路線C
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2020-04-25 23:29:31 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,322 bytes |
| コンパイル時間 | 2,627 ms |
| コンパイル使用メモリ | 195,108 KB |
| 最終ジャッジ日時 | 2025-01-10 01:44:22 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 WA * 1 |
| other | AC * 9 WA * 3 |
ソースコード
typedef long long ll;
#include <bits/stdc++.h>
using namespace std;
int main() {
vector<ll> dis(3);
for (int i = 0; i < 3; i++) {
std::cin >> dis[i];
}
pair<ll,ll> start,end;
char t1,t2;
ll tt1,tt2;
std::cin >> t1>>tt1;
std::cin >> t2>>tt2;
start = {t1-'A',tt1};
end = {t2-'A',tt2};
if(start.first==end.first){
std::cout << min({
abs(start.second-end.second),
min(start.second,dis[start.first]-start.second)+
min(end.second,dis[end.first]-end.second)+
min(dis[(start.first+1)%3],dis[(start.first+2)%3]),
start.second+end.second-dis[start.first]+
min(dis[(start.first+1)%3],dis[(start.first+2)%3])
}) << std::endl;
}else{
std::cout <<
min({
start.second+
end.second,
dis[start.first]-start.second+1+
dis[end.first]-end.second,
start.second+
dis[3-start.first-end.first]+
dis[end.first]-end.second,
dis[start.first]-start.second+
dis[3-start.first-end.first]+
end.second
})
<< std::endl;
}
}