結果

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

ソースコード

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 (an != bn) cout << s << endl;
    else if (n >= 2) cout << f << endl;
    else if (n == 0){
        if (a == b) cout << f << endl;
        else cout << s << endl;
    } else {
        if (bn == 1){
            if (b[0] == 'o' && a[2] == 'o') cout << s << endl;
            else if (b[2] == 'o' && a[0] == 'o') cout << s << endl;
            else if (b[1] == 'o' && a[1] == 'o') cout << s << endl;
            else cout << f << endl;  
        } else if (bn == 2){
            if (b[0] == 'x' && a[2] == 'x') cout << s << endl;
            else if (b[2] == 'x' && a[0] == 'x') cout << s << endl;
            else if (b[1] == 'x' && a[1] == 'x') cout << s << endl;
            else cout << f << endl;
        } else cout << f << endl;
    }
}
0