結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  mannshi222 | 
| 提出日時 | 2022-03-27 23:06:46 | 
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 960 bytes | 
| コンパイル時間 | 779 ms | 
| コンパイル使用メモリ | 84,904 KB | 
| 最終ジャッジ日時 | 2025-01-28 13:08:55 | 
| ジャッジサーバーID (参考情報) | judge4 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
#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;
}
            
            
            
        