結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2016-03-11 09:08:12 | 
| 言語 | C++11(廃止可能性あり) (gcc 13.3.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 558 bytes | 
| コンパイル時間 | 553 ms | 
| コンパイル使用メモリ | 60,960 KB | 
| 実行使用メモリ | 6,944 KB | 
| 最終ジャッジ日時 | 2024-09-25 00:09:43 | 
| 合計ジャッジ時間 | 1,119 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
#include <iostream>
#include <string>
#include <vector>
int main() {
	int n;
	std::cin >> n;
	const std::vector<int> flags{ 1,2,4,8,16,32,64,128,256,512 };
	int flag = ~0;
	for (; n > 0; --n) {
		int a, b, c, d;
		std::string res;
		std::cin >> a >> b >> c >> d >> res;
		int bit = 0;
		for (const auto &f : { a, b, c, d }) {
			bit |= flags.at(f);
		}
		if (res == "NO") {
			flag &= (~bit);
		}
		else {
			flag &= bit;
		}
	}
	for (auto i = 0; i < 10; ++i) {
		if ((flags.at(i) & flag) != 0) {
			std::cout << i << std::endl;
			break;
		}
	}
	return 0;
}
            
            
            
        