結果

問題 No.197 手品
ユーザー agatan
提出日時 2015-05-04 22:19:47
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 818 bytes
コンパイル時間 619 ms
コンパイル使用メモリ 74,184 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-07-20 03:39:01
合計ジャッジ時間 1,942 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
#include <functional>
#include <algorithm>
#include <cmath>
#include <array>
#include <bitset>
#include <set>

#define REP(i,n) for(int i=0;i<(n);i++)

using namespace std;



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

    string bef, aft;
    int N;
    cin >> bef >> N >> aft;

    bool succ = false;
    if (count(bef.begin(), bef.end(), 'o') != count(aft.begin(), aft.end(), 'o')) {
        succ = true;
    } else if (N >= 2) {
        succ = false;
    } else if (N == 0) {
        succ = bef != aft;
    } else {
        string b1 = bef, b2 = bef;
        swap(b1[0], b1[1]);
        swap(b2[1], b2[2]);
        succ = b1 != aft && b2 != aft;
    }
    if (succ) cout << "SUCCESS" << endl;
    else cout << "FAILURE\n";
    return 0;
}
0