結果

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

ソースコード

diff #

#include <algorithm>
#include <vector>
#include <cfloat>
#include <string>
#include <cmath>
#include <set>
#include <cstdlib>
#include <map>
#include <ctime>
#include <iomanip>
#include <functional>
#include <deque>
#include <iostream>
#include <cstring>
#include <queue>
#include <cstdio>
#include <stack>
#include <climits>
#include <cctype>

using namespace std;

typedef long long ll;

int main() {
	string s;
	cin >> s;
	int a;
	cin >> a;
	string z;
	cin >> z;
	int cnt1, cnt2;
	cnt1 = cnt2 = 0;
	for (int i = 0; i < s.size(); i++) {
		cnt1 += s[i] == 'o';
	}
	for (int i = 0; i < z.size(); i++) {
		cnt2 += z[i] == 'o';
	}
	if (cnt1 != cnt2) {
		cout << "SUCCESS" << endl;
		return 0;
	}
	string s1 = { s[1], s[0], s[2] }, s2 = { s[0], s[2], s[1] };
	string t1 = { s[1], s[2], s[0] }, t2 = { s[2], s[0], s[1] };
	string u = { s[2], s[1], s[0] };
	if ((a == 0 && s == z) ||
		(a%2 != 0 && (z == s1 || z == s2)) ||
		((a >= 3 && a%2 != 0) && z == u) ||
		(a > 0 && a%2 == 0 && (z == t1 || z == t2)) ||
		(a > 0 && a%2 == 0 && s == z)) {
		cout << "FAILURE" << endl;
	}else {
		cout << "SUCCESS" << endl;
	}

	return 0;
}
0