結果

問題 No.859 路線A、路線B、路線C
ユーザー i_am_nicolen_22i_am_nicolen_22
提出日時 2019-08-09 23:19:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 2,515 bytes
コンパイル時間 1,534 ms
コンパイル使用メモリ 167,156 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-26 22:02:28
合計ジャッジ時間 2,795 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>


using namespace std;

#define REP(i, s) for (int i = 0; i < s; ++i)
#define ALL(v) (v).begin(), (v).end()
#define COUT(x) cout << #x << " = " << (x) << " (L" << __LINE__ << ")" << endl
#define EACH(i, s) for (__typeof__((s).begin()) i = (s).begin(); i != (s).end(); ++i)
#define DEBUG
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
template<class T1, class T2> ostream& operator << (ostream &s, pair<T1,T2> P)
{ return s << '<' << P.first << ", " << P.second << '>'; }
template<class T> ostream& operator << (ostream &s, vector<T> P)
{ for (int i = 0; i < P.size(); ++i) { if (i > 0) { s << " "; } s << P[i]; } return s; }
template<class T> ostream& operator << (ostream &s, vector<vector<T> > P)
{ for (int i = 0; i < P.size(); ++i) { s << endl << P[i]; } return s << endl; }
template<class T> ostream& operator << (ostream &s, set<T> P)
{ EACH(it, P) { s << "<" << *it << "> "; } return s << endl; }
template<class T1, class T2> ostream& operator << (ostream &s, map<T1,T2> P)
{ EACH(it, P) { s << "<" << it->first << "->" << it->second << "> "; } return s << endl; }
template<class T>void show(vector<T>v){for (int i = 0; i < v.size(); i++){cerr<<v[i]<<" ";}cerr<<"\n";}
typedef long long ll;

int main(){
   
    ll x,y,z;
    string s1,s2;
    ll t1,t2;
    cin>>x>>y>>z;
    cin>>s1>>t1>>s2>>t2;
   if(s1==s2 && s1=="A"){
       cout<<min({abs(t1-t2),t1-1+y+(x-t2)+1,t1-1+z+(x-t2)+1})<<endl;
   }

    if(s1==s2 && s1=="B"){
       cout<<min({abs(t1-t2),t1-1+x+(y-t2)+1,t1-1+z+(y-t2)+1})<<endl;
   }
    if(s1==s2 && s1=="C"){
       cout<<min({abs(t1-t2),t1-1+x+(z-t2)+1,t1-1+y+(z-t2)+1})<<endl;
   }
    if((s1=="A" && s2=="C") ){
        cout<<min({t1-1+t2-1+1,x-t1+z-t2+1, t1-1+1+y+z-t2,t2-1+1+y+x-t1})<<endl;
    }
    if(s1=="C" && s2=="A"){
           cout<<min({t1-1+t2-1+1,z-t1+x-t2+1, t1-1+1+y+x-t2,t2-1+1+y+z-t1})<<endl;
    
    }
    if((s1=="A" && s2=="B") ){
        cout<<min({t1-1+t2-1+1,x-t1+y-t2+1,t1-1+1+z+y-t2,t2-1+1+z+x-t1})<<endl;
    }
    if(s1=="B" && s2=="A"){
           cout<<min({t1-1+t2-1+1,y-t1+x-t2+1,t1-1+1+z+x-t2,t2-1+1+z+y-t1})<<endl;
    
    }
    if((s1=="B" && s2=="C") ){
        cout<<min({t1-1+t2-1+1,y-t1+z-t2+1,t1-1+1+x+z-t2,t2-1+1+x+y-t1})<<endl;
    }
    if(s1=="C" && s2=="B"){
            cout<<min({t1-1+t2-1+1,z-t1+y-t2+1,t1-1+1+x+y-t2,t2-1+1+x+z-t1})<<endl;
    
    }


    return 0;
}
   
0