結果
| 問題 | No.859 路線A、路線B、路線C |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-09 21:44:47 |
| 言語 | C++14 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 840 bytes |
| 記録 | |
| コンパイル時間 | 551 ms |
| コンパイル使用メモリ | 66,744 KB |
| 実行使用メモリ | 6,940 KB |
| 最終ジャッジ日時 | 2024-07-19 11:34:32 |
| 合計ジャッジ時間 | 1,130 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 WA * 1 |
ソースコード
#include <iostream>
#include <string>
using namespace std;
typedef long long int ll;
int main(){
ll x,y,z; cin >> x >> y >> z;
char s1,s2; ll t1,t2;
cin >> s1 >> t1 >> s2 >> t2;
if(s1==s2&&s1=='A'){
if(t1>t2)swap(t1,t2);
cout << min(t1-t2+x+z,min(t1+y+x-t2,t2-t1)) << endl;
}
if(s1==s2&&s1=='B'){
if(t1>t2)swap(t1,t2);
cout << min(t1-t2+y+z,min(t1+y+x-t2,t2-t1)) << endl;
}
if(s1==s2&&s1=='C'){
if(t1>t2)swap(t1,t2);
cout << min(t1-t2+y+z,min(t1+z+x-t2,t2-t1)) << endl;
}
if(s1>s2){
swap(s1,s2);
swap(t1,t2);
}
if(s1=='A'&&s2=='B'){
cout << min(t1-1+t2,min(t1+z+y-t2,min(x-t1+y-t2+1,x-t1+z+t2))) << endl;
}
if(s1=='B'&&s2=='C'){
cout << min(t1-1+t2,min(t1+x+z-t2,min(y-t1+z-t2+1,y-t1+x+t2))) << endl;
}
if(s1=='A'&&s2=='C'){
cout << min(t1-1+t2,min(t1+y+x-t2,min(z-t1+x-t2+1,z-t1+y+t2))) << endl;
}
}