結果

問題 No.24 数当てゲーム
ユーザー sora410_tsora410_t
提出日時 2020-03-31 16:11:00
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 665 bytes
コンパイル時間 672 ms
コンパイル使用メモリ 78,084 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-07 00:50:58
合計ジャッジ時間 1,447 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
#include <climits>
#include <numeric>
#include <iterator>
#include <cmath>
#include <set>
#include <bitset>
#include <cassert>
using namespace std;

int main() {
	bitset<10> res {};
	res.set();
	
	int N {};
	cin >> N;

	for (int i = 0; i < N; ++i) {
		bitset<10> tmp {};
		for (int j = 0; j < 4; ++j) {
			int d {};
			cin >> d;
			tmp.set(d);
		}
		string flag {};
		cin >> flag;
		if (flag == "YES") {
			res &= tmp;
		} else {
			res &= ~tmp;
		}
	}
	assert(res.count() == 1);
	for (int k = 0; k < 10; ++k) {
		if (res[k] == 1) {
			cout << k << endl;
			return 0;
		}
	}
	return 1;
}
0