結果
| 問題 | No.859 路線A、路線B、路線C |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2019-08-09 21:51:35 |
| 言語 | C++14 (gcc 15.3.0 + boost 1.92.0 + ACL) |
| 結果 |
AC
不安定
|
| 実行時間 | 1 ms / 1,000 ms |
| + 230µs | |
| コード長 | 840 bytes |
| 記録 | |
| コンパイル時間 | 318 ms |
| コンパイル使用メモリ | 74,624 KB |
| 実行使用メモリ | 5,888 KB |
| 最終ジャッジ日時 | 2026-08-18 14:03:01 |
| 合計ジャッジ時間 | 1,737 ms |
|
ジャッジサーバーID (参考情報) |
judge2_0 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
#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+z-t2,min(x-t1+z-t2+1,x-t1+y+t2))) << endl;
}
}