結果

問題 No.197 手品
ユーザー m1025o1184t
提出日時 2019-12-30 01:16:03
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 701 bytes
コンパイル時間 1,940 ms
コンパイル使用メモリ 170,316 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-11-06 23:17:11
合計ジャッジ時間 3,211 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3 WA * 1
other AC * 37 WA * 6
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<(n);++i)
#define all(a) (a).begin(),(a).end()
#define dunk(a) cout << (a) << endl
using namespace std;
typedef long long ll;

int main() {
	ios::sync_with_stdio(false);
	cin.tie(0);
	string S, T;
	ll n;
	cin >> S >> n >> T;

	if (S[0] == 'x' && S[2] == 'o') {
		reverse(all(S));
		reverse(all(T));
	}
	rep(i, 3) {
		if (S[i] == 'o') S[i] = 'A';
		else S[i] = 'B';
		if (T[i] == 'o') T[i] = 'A';
		else T[i] = 'B';
	}
	if (n >= 6) sort(all(S));
	if (n == 1) next_permutation(all(S));
	n++;
	do {
		if (S == T) {
			dunk("FAILURE");
			return 0;
		}
		n--;
		if (n == 0) break;
	} while (next_permutation(all(S)));

	dunk("SUCCESS");

	return 0;
}
0