結果

問題 No.197 手品
ユーザー SSRS
提出日時 2020-11-18 15:48:12
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 1,000 ms
コード長 923 bytes
コンパイル時間 658 ms
コンパイル使用メモリ 74,784 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-07-23 09:02:45
合計ジャッジ時間 1,912 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 43
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <vector>
using namespace std;
vector<vector<int>> E = {{0}, {1, 2}, {1, 4}, {3, 5}, {2, 4}, {3, 6}, {5, 6}, {7}}; 
int main(){
	string S;
	cin >> S;
	int N;
	cin >> N;
	string T;
	cin >> T;
	if (N >= 2){
		N = N % 2 + 2;
	}
	int s = 0;
	for (int i = 0; i < 3; i++){
		if (S[i] == 'o'){
			s += 1 << i;
		}
	}
	int t = 0;
	for (int i = 0; i < 3; i++){
		if (T[i] == 'o'){
			t += 1 << i;
		}
	}
	bool ok = false;
	if (N == 0){
		if (s == t){
			ok = true;
		}
	}
	if (N == 1){
		for (int u : E[s]){
			if (u == t){
				ok = true;
			}
		}
	}
	if (N == 2){
		for (int u : E[s]){
			for (int v : E[u]){
				if (v == t){
					ok = true;
				}
			}
		}
	}
	if (N == 3){
		for (int u : E[s]){
			for (int v : E[u]){
				for (int w : E[v]){
					if (w == t){
						ok = true;
					}
				}
			}
		}
	}
	if (ok){
		cout << "FAILURE" << endl;
	} else {
		cout << "SUCCESS" << endl;
	}
}
0