結果

問題 No.24 数当てゲーム
ユーザー mannshi222mannshi222
提出日時 2022-03-27 23:06:46
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 960 bytes
コンパイル時間 1,046 ms
コンパイル使用メモリ 88,652 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-24 08:38:18
合計ジャッジ時間 1,280 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <string>
#include <set>

using namespace std;

int main()
{
	int N;
	vector<int> A(4);
	string R;
	set<int> yes;
	set<int> no;
	yes = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
	no.clear();

	cin >> N;
	for( int i = 0; i < N; i++ ) {
		cin >> A[0] >> A[1] >> A[2] >> A[3] >> R;
		if( R == "NO" ) {
			for(auto x: A ) {
				no.insert(x);	
			}
		}
		else {
			set<int> tmp;
			tmp.clear();
			for(auto x: A ) {
				tmp.insert(x);
			}
			set<int> tmp2;
			tmp2.clear();
			for( auto a: tmp ) {
			for( auto b : yes ) {
					if( a == b ) {
						tmp2.insert(a);
						}
				}
			}
			yes = tmp2;
		}
	}	
	/*
	cout << "YES" << endl;
	for( auto x : yes ) {
		cout << x << endl;
	}
	cout << "NO" << endl;
	for( auto x : no ) {
		cout << x << endl;
	}

	for( auto n : no) {
		yes.erase( n );
	}
	cout << "ANSWER" << endl;
	*/
	for( auto n : no) {
		yes.erase( n );
	}
	for( auto y : yes ) {
		cout << y << endl;
	}


	return 0;
}
0