結果

問題 No.859 路線A、路線B、路線C
ユーザー CleyLCleyL
提出日時 2019-08-09 21:46:48
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 673 bytes
コンパイル時間 790 ms
コンパイル使用メモリ 63,636 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-26 17:38:10
合計ジャッジ時間 1,430 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
using namespace std;
#define x34 min(a2,b2)
#define y34 max(a2,b2)
int main(){
  int a,b,c;cin>>a>>b>>c;
  char a1;int a2;cin>>a1>>a2;
  char b1;int b2;cin>>b1>>b2;
  if(a1==b1){
    if(a1=='A')cout << min(y34-x34,x34+(a-y34)+(min(c,b)+1)) << endl;
    if(a1=='B')cout << min(y34-x34,x34+(b-y34)+(min(a,c)+1)) << endl;
    if(a1=='C')cout << min(y34-x34,x34+(c-y34)+(min(a,b)+1)) << endl;
  }else{
    if(min(b2,a2)=='A'){
      if(max(b2,a2)=='B') cout << min(x34+y34-1,(a-x34)+(b-y34)) << endl;
      else cout << min(x34+y34-1,(a-x34)+(c-y34)) << endl;
    }else cout << min(x34+y34-1,(b-x34)+(c-y34)) << endl;
  }
}


//Ax->By 
//Ax->Cy m
//Bx->Cy 
0