結果

問題 No.197 手品
ユーザー zaki_johozaki_joho
提出日時 2018-12-24 13:47:59
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,849 bytes
コンパイル時間 1,482 ms
コンパイル使用メモリ 160,896 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-26 02:59:37
合計ジャッジ時間 4,077 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 1 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 WA -
testcase_13 AC 2 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 AC 2 ms
4,348 KB
testcase_24 AC 1 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 1 ms
4,348 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,348 KB
testcase_29 WA -
testcase_30 AC 2 ms
4,348 KB
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 1 ms
4,348 KB
testcase_33 WA -
testcase_34 AC 1 ms
4,348 KB
testcase_35 AC 2 ms
4,348 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 1 ms
4,348 KB
testcase_39 WA -
testcase_40 AC 2 ms
4,348 KB
testcase_41 WA -
testcase_42 AC 1 ms
4,348 KB
testcase_43 AC 2 ms
4,348 KB
testcase_44 WA -
testcase_45 AC 1 ms
4,348 KB
testcase_46 WA -
権限があれば一括ダウンロードができます

ソースコード

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