結果

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

ソースコード

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 - 1) % 2 + 1;
	}
	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 v : E[s]){
			if (v == t){
				ok = true;
			}
		}
	}
	if (N == 2){
		for (int v : E[s]){
			for (int w : E[v]){
				if (w == t){
					ok = true;
				}
			}
		}
	}
	if (ok){
		cout << "FAILURE" << endl;
	} else {
		cout << "SUCCESS" << endl;
	}
}
0