結果

問題 No.197 手品
ユーザー zaki_joho
提出日時 2018-12-24 13:47:59
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 1,849 bytes
コンパイル時間 1,187 ms
コンパイル使用メモリ 159,984 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-25 10:59:20
合計ジャッジ時間 2,720 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 24 WA * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 (cnt1 == 1)
    {
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (s1[i] == 'o' && s2[j] == 'o')
                {
                    int d = abs(i - j);
                    if (d <= n && d % 2 == n % 2)
                    {
                        cout << "FAILURE" << endl;
                    }
                    else
                    {
                        cout << "SUCCESS" << endl;
                    }
                    return 0;
                }
            }
        }
    }
    if (cnt2 == 2)
    {
        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                if (s1[i] == 'x' && s2[j] == 'x')
                {
                    int d = abs(i - j);
                    if (d <= n && d % 2 == n % 2)
                    {
                        cout << "FAILURE" << endl;
                    }
                    else
                    {
                        cout << "SUCCESS" << endl;
                    }
                    return 0;
                }
            }
        }
    }
}
0