結果
問題 |
No.197 手品
|
ユーザー |
![]() |
提出日時 | 2015-06-13 12:06:43 |
言語 | C++11(廃止可能性あり) (gcc 13.3.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,689 bytes |
コンパイル時間 | 688 ms |
コンパイル使用メモリ | 68,152 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-27 09:50:01 |
合計ジャッジ時間 | 1,745 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 37 WA * 6 |
ソースコード
#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){ cout << "FAILURE" << endl; } 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){ cout << "FAILURE" << endl; } 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; }