結果
| 問題 | No.24 数当てゲーム | 
| コンテスト | |
| ユーザー |  hiragn | 
| 提出日時 | 2019-07-16 04:13:40 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 5,000 ms | 
| コード長 | 729 bytes | 
| コンパイル時間 | 1,981 ms | 
| コンパイル使用メモリ | 177,028 KB | 
| 実行使用メモリ | 5,248 KB | 
| 最終ジャッジ日時 | 2024-11-29 02:09:40 | 
| 合計ジャッジ時間 | 2,434 ms | 
| ジャッジサーバーID (参考情報) | judge1 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 10 | 
ソースコード
#include <bits/stdc++.h>
using namespace std;
int main() {
    int N;
    cin >> N;
    set<int> ans = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    for (int i = 0; i < N; ++i) {
        int a, b, c, d;
        string s;
        cin >> a >> b >> c >> d >> s;
        set<int> st = {a, b, c, d};
        if (s == "YES") {
            vector<int> vt;
            set_intersection(ans.begin(), ans.end(),
                             st.begin(), st.end(), back_inserter(vt));
            ans.clear();
            for (auto x:vt) ans.insert(x);
        } else {
            ans.erase(a);
            ans.erase(b);
            ans.erase(c);
            ans.erase(d);
        }
    }
    for (auto x:ans) cout << x << endl;
    return 0;
}
            
            
            
        