結果
| 問題 | 
                            No.859 路線A、路線B、路線C
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2020-04-25 22:52:42 | 
| 言語 | C++17  (gcc 13.3.0 + boost 1.87.0)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 1,326 bytes | 
| コンパイル時間 | 2,592 ms | 
| コンパイル使用メモリ | 194,976 KB | 
| 最終ジャッジ日時 | 2025-01-10 01:43:44 | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 4 WA * 8 | 
ソースコード
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-1,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-1,
                
                dis[start.first]-start.second+
                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-1
            })
        << std::endl;
    }
}