結果

問題 No.197 手品
ユーザー kpinkcat
提出日時 2023-11-05 19:01:19
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,206 bytes
コンパイル時間 2,419 ms
コンパイル使用メモリ 193,476 KB
最終ジャッジ日時 2025-02-17 19:26:51
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 24 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<iomanip>
#include<string>
#include<algorithm>
#include<vector>
#include<set>
#include<list>
#include<queue>
#include<math.h>
#include<bitset>
using ll = long long;
using namespace std;


int main(){
    string a, b, f = "FAILURE", s = "SUCCESS";
    int n, an = 0, bn = 0;
    cin >> b >> n >> a;
    bool yes = false;
    for (int i = 0; i < 3; i++){
        if (b[i] == 'o') bn++;
        if (a[i] == 'o') an++;
    }
    if (bn == 1){
        if (b[0] == 'o' || b[2] == 'o'){
            if ((n%2) && (a[0] == 'o' || a[2] == 'o')) yes = true;
            else if (!(n%2) && a[1] == 'o') yes = true;
        } else {
            if ((n%2) && a[1] == 'o') yes = true;
            else if (!(n%2) && a[1] == 'x') yes = true;
        }
    } else if (bn == 2){
        if ((b[0] == 'x' || b[2] == 'x')) {
            if ((n%2) && a[1] == 'o') yes = true;
            else if (!(n%2) && a[1] == 'x') yes = true;
        } else {
            if ((n%2) && a[1] == 'x') yes = true;
            else if (!(n%2) && a[1] == 'o') yes = true;
        }
    }
    if (an != bn) cout << s << endl;
    else if (yes) cout << s << endl;
    else cout << f << endl;
}
0