結果

問題 No.197 手品
ユーザー face4
提出日時 2018-05-05 19:04:42
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,028 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 65,408 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-28 01:59:51
合計ジャッジ時間 1,935 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 20 WA * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 && 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 == 2 && n < 2){
            result = "SUCCESS";
        }else if(diff%2 == 0){
            if(n%2 == 1)    result = "SUCCESS";
            else            result = "FAILURE";
        }else if(diff == 1){
            if(n%2 == 0)    result = "FAILURE";
            else            result = "SUCCESS";
        }
    }else{
        result = "SUCCESS";
    }

    cout << result << endl;
    return 0;
}
0