結果

問題 No.24 数当てゲーム
ユーザー sawfish
提出日時 2022-11-12 14:03:11
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 913 bytes
コンパイル時間 3,268 ms
コンパイル使用メモリ 129,836 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-14 05:04:38
合計ジャッジ時間 3,678 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <set>
#include <algorithm>

using namespace std;
using LL = long long;

int main() {
    int N;
    cin >> N;

    set<int> ans;
    for (int i = 0; i <= 9; i++) ans.insert(i);

    for (int i = 0; i < N; i++) {
        set<int> ans_;
        set<int> diff;
        int A;
        string R;
        for (int j = 0; j < 4; j++) {
            cin >> A;
            diff.insert(A);
        }
        cin >> R;
        if (R == "YES") {
            set_intersection(
                    ans.begin(), ans.end(),
                    diff.begin(), diff.end(),
                    inserter(ans_, ans_.end())
            );
        } else {
            set_difference(
                    ans.begin(), ans.end(),
                    diff.begin(), diff.end(),
                    inserter(ans_, ans_.end())
            );
        }
        ans = ans_;
    }

    cout << *ans.begin() << endl;
}
0