結果
問題 | No.197 手品 |
ユーザー |
![]() |
提出日時 | 2015-06-13 12:11:56 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
AC
|
実行時間 | 2 ms / 1,000 ms |
コード長 | 1,773 bytes |
コンパイル時間 | 905 ms |
コンパイル使用メモリ | 68,160 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-07-20 03:41:19 |
合計ジャッジ時間 | 2,038 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 43 |
ソースコード
#include <iostream> #include <vector> #include <algorithm> #include <iomanip> using namespace std; typedef long long LL; int main(){ string before, after; int N; cin >> before >> N >> after; int cnt_b = 0, cnt_a = 0; for(int i = 0; i < 3; i++) cnt_b += before[i]=='o'? 1: 0; for(int i = 0; i < 3; i++) cnt_a += after[i]=='o'? 1: 0; if(cnt_a != cnt_b){ cout << "SUCCESS" << endl; return 0; } if(cnt_a == 1){ if(before == after && N == 1 && before[1] == 'o'){ cout << "SUCCESS" << endl; return 0; } int pos_b = 0; int pos_a = 0; for(int i = 0; i < 3; i++){ if(before[i]=='o'){ pos_b = i; break; } } for(int i = 0; i < 3; i++){ if(after[i]=='o'){ pos_a = i; break; } } if(max(pos_a-pos_b, pos_b-pos_a) > N){ cout << "SUCCESS" << endl; }else{ cout << "FAILURE" << endl; } }else if(cnt_a == 2){ if(before == after && N == 1 && before[1] == 'x'){ cout << "SUCCESS" << endl; return 0; } int pos_b = 0; int pos_a = 0; for(int i = 0; i < 3; i++){ if(before[i]=='x'){ pos_b = i; break; } } for(int i = 0; i < 3; i++){ if(after[i]=='x'){ pos_a = i; break; } } if(max(pos_a-pos_b, pos_b-pos_a) > N){ cout << "SUCCESS" << endl; }else{ cout << "FAILURE" << endl; } }else{ cout << "FAILURE" << endl; } return 0; }