結果

問題 No.197 手品
コンテスト
ユーザー zaki_joho
提出日時 2018-12-24 14:05:00
言語 C++11
(gcc 15.3.0 + boost 1.92.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++11 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 1 ms / 1,000 ms
+ 327µs
コード長 1,516 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 905 ms
コンパイル使用メモリ 176,904 KB
実行使用メモリ 5,888 KB
最終ジャッジ日時 2026-08-19 11:15:53
合計ジャッジ時間 3,090 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include "bits/stdc++.h"

using namespace std;

using ll = long long;
using ld = long double;
using P = pair<int, int>;
constexpr ld EPS = 1e-12;
constexpr int INF = numeric_limits<int>::max() / 2;
constexpr int MOD = 1e9 + 7;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);

    string s1, s2;
    int n;
    cin >> s1 >> n >> s2;
    int cnt1 = 0, cnt2 = 0;
    for (int i = 0; i < 3; i++)
    {
        if (s1[i] == 'o')
            cnt1++;
        if (s2[i] == 'o')
            cnt2++;
    }
    if (cnt1 != cnt2)
    {
        cout << "SUCCESS" << endl;
        return 0;
    }
    if (cnt1 == 0 || cnt1 == 3)
    {
        cout << "FAILURE" << endl;
        return 0;
    }
    if (n == 0)
    {
        if (s1 == s2)
            cout << "FAILURE" << endl;
        else
            cout << "SUCCESS" << endl;
        return 0;
    }
    if (n >= 2)
    {
        cout << "FAILURE" << endl;
        return 0;
    }
    if (s1 == "oxx" && s2 == "xxo")
    {
        cout << "SUCCESS" << endl;
    }
    else if (s1 == "xxo" && s2 == "oxx")
    {
        cout << "SUCCESS" << endl;
    }
    else if (s1 == "xoo" && s2 == "oox")
    {
        cout << "SUCCESS" << endl;
    }
    else if (s1 == "oox" && s2 == "xoo")
    {
        cout << "SUCCESS" << endl;
    }
    else if (s1 == "xox" && s2 == "xox")
    {
        cout << "SUCCESS" << endl;
    }
    else if (s1 == "oxo" && s2 == "oxo")
    {
        cout << "SUCCESS" << endl;
    }
    else
    {
        cout << "FAILURE" << endl;
    }
}
0