結果
問題 | No.197 手品 |
ユーザー |
|
提出日時 | 2018-05-05 19:16:10 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,029 bytes |
コンパイル時間 | 885 ms |
コンパイル使用メモリ | 65,664 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-06-28 02:00:10 |
合計ジャッジ時間 | 1,734 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 37 WA * 6 |
ソースコード
#include<iostream> using namespace std; int main(){ string before, after, result; int n; cin >> before >> n >> after; int bo = 0, ao = 0, ax = 0, bx = 0; for(int i = 0; i < 3; i++){ if(before[i] == 'o') bo++; else bx++; if(after[i] == 'o') ao++; else ax++; } if(bo+ao == 6 || bx+ax == 6){ cout << "FAILURE"; }else if(before == after){ if(n != 1) result = "FAILURE"; else result = "SUCCESS"; }else if(bo == ao && bx == ax){ string s; if(bo == 1){ s = "o"; }else if(bx == 1){ s = "x"; } int bef = before.find(s); int aft = after.find(s); int diff = abs(bef-aft); if((diff == 0 && n == 1) || (diff == 1 && n == 0)){ result = "SUCCESS"; }else{ result = "FAILURE"; } }else{ result = "SUCCESS"; } cout << result << endl; return 0; }