結果

問題 No.197 手品
ユーザー mmn15277198mmn15277198
提出日時 2021-04-13 19:47:23
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 3,822 bytes
コンパイル時間 1,056 ms
コンパイル使用メモリ 101,192 KB
実行使用メモリ 6,516 KB
最終ジャッジ日時 2023-09-12 12:04:26
合計ジャッジ時間 2,925 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 4 ms
6,212 KB
testcase_01 AC 4 ms
6,420 KB
testcase_02 AC 4 ms
6,272 KB
testcase_03 AC 4 ms
6,416 KB
testcase_04 AC 4 ms
6,420 KB
testcase_05 WA -
testcase_06 AC 4 ms
6,212 KB
testcase_07 AC 4 ms
6,208 KB
testcase_08 WA -
testcase_09 AC 4 ms
6,412 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
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 4 ms
6,408 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 4 ms
6,300 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 4 ms
6,240 KB
testcase_31 AC 5 ms
6,204 KB
testcase_32 AC 4 ms
6,416 KB
testcase_33 WA -
testcase_34 AC 4 ms
6,300 KB
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 4 ms
6,300 KB
testcase_41 WA -
testcase_42 AC 5 ms
6,204 KB
testcase_43 AC 4 ms
6,488 KB
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘void solve()’ 内:
main.cpp:138:5: 警告: ‘cnt_3’ may be used uninitialized [-Wmaybe-uninitialized]
  138 |     if (cnt_3 != cnt_4) {
      |     ^~
main.cpp:135:9: 備考: ‘cnt_3’ はここで定義されています
  135 |     int cnt_3 , cnt_4 = 0;
      |         ^~~~~

ソースコード

diff #

#include <iostream>
#include <vector>
#include <functional>
#include <algorithm>
#include <map>
#include <cstdio>
#include <cmath>
#include <iomanip>
#include <queue>

using namespace std;

#define rep(i,n) for (int i = 0; i < (n); i++)
#define vi vector<int>
#define vll vector<long long>
#define vb vector<bool>
#define vs vector<string>
#define all(x) x.begin() , x.end()
#define pb push_back
#define eb emplace_back
#define chmax(x,y) (x) = max((x) , (y))
#define chmin(x,y) (x) = min((x) , (y))
#define fi first
#define se second

typedef long long ll;
typedef long double ld;

//const int MOD = int(1e9) + 7;
//const int MOD = 998244353;
const ll MOD = ll(1e9) + 7;
//const ll MOD = 998244353;
const ld PI = 3.1415926535897932384626;
const int INF = 1001001001;
const ll LINF = 1001001001001001001;
const int MX = 220000;

ll gcd (ll a , ll b) { if (a < b) swap(a , b); if (a % b == 0) return b; else return gcd(b , a % b); }
ll lcm (ll a , ll b) { return a / gcd(a , b) * b; }
ll lin() { ll x; scanf("%lld" , &x); return x; }
int in() { int x; scanf("%d" , &x); return x; }

void io_setup() {
    cout << fixed << setprecision(30);
}

ll modpow (ll x , ll p) {
    ll ret = 1;
    while (p) {
        if (p % 2 == 1) {
            ret *= x;
            ret %= MOD;
        }
        x *= x;
        x %= MOD;
        p /= 2;
    }
    return ret;
}

ll moddiv (ll a , ll b) {
    return a * modpow(b , MOD - 2) % MOD;
}

ll modsub (ll a , ll b) {
    if (a >= b) return (a - b) % MOD;
    else return (MOD - a + b);
}

vll fact(MX);
vll factinv(MX);
void init_fact () {
    fact[0] = 1;
    for (int i = 1; i < MX; i++) {
        fact[i] = 1LL * i * fact[i - 1] % MOD;
    }
    for (int i = 0; i < MX; i++) {
        factinv[i] = modpow(fact[i] , MOD - 2);
    }
}

ll nCk (ll n , ll k) {
    return ((fact[n] * factinv[k] % MOD) * factinv[n - k] % MOD);
}

bool is_prime (int x) {
    if (x == 2 || x == 3 || x == 5 || x == 7) {
        return true;
    }
    for (ll i = 2; i*i <= x; i++) {
        if (x % i == 0) {
            return false;
        }
    }
    return true;
}

vb prime_table(MX , true);
void init_prime() {
    for (int i = 2; i < MX; i++) {
        for (int j = i + i; j < MX; j += i) {
            prime_table[j] = false;
        }
    }
    return;
}

void solve () {
    string s;
    cin >> s;
    ll n = lin();
    string t;
    cin >> t;
    if (n == 0) {
        if (s != t) {
            cout << "SUCCESS" << endl;
        } else {
            cout << "FAILURE" << endl;
        }
        return;
    }
    int cnt_1 = 0 , cnt_2 = 0;
    for (auto i : s) {
        cnt_1 += (i == 'o');
        cnt_2 += (i == 'x');
    }
    for (auto i : t) {
        cnt_1 += (i == 'o');
        cnt_2 += (i == 'x');
    }
    if (cnt_1 == 0 || cnt_2 == 0) {
        cout << "FAILURE" << endl;
        return;
    }
    int cnt_3 , cnt_4 = 0;
    for (auto i : s) cnt_3 += (i == 'o');
    for (auto i : t) cnt_4 += (i == 'o');
    if (cnt_3 != cnt_4) {
        cout << "SUCCESS" << endl;
        return;
    }
    string s2_1 = s; swap(s2_1[0] , s2_1[1]); swap(s2_1[1] , s2_1[2]);
    string s2_2 = s; swap(s2_2[1] , s2_2[2]); swap(s2_2[0] , s2_2[1]);
    if (n % 2 == 0) {
        if (s == t || t == s2_1 || t == s2_2) {
            cout << "FAILURE" << endl;
        } else {
            cout << "SUCCESS" << endl;
        }
        return;
    }
    string s1_1 = s; swap(s1_1[0] , s1_1[1]);
    string s1_2 = s; swap(s1_2[1] , s1_2[2]);
    string s1_3 = s; reverse(all(s1_3));
    if (n % 2 == 1) {
        if (t == s1_1 || t == s1_2 || t == s1_3) {
            cout << "FAILURE" << endl;
        } else {
            cout << "SUCCESS" << endl;
        }
        return;
    }
    return;
}

int main() {
    io_setup();
    //init_fact();
    //init_prime();
    solve();
    return 0;
}





0