結果

問題 No.24 数当てゲーム
ユーザー yudedakoyudedako
提出日時 2016-03-11 09:08:12
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 558 bytes
コンパイル時間 559 ms
コンパイル使用メモリ 61,176 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-25 04:44:46
合計ジャッジ時間 1,201 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 1 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 1 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
}
0