結果

問題 No.24 数当てゲーム
ユーザー h_noson
提出日時 2016-02-15 22:40:20
言語 C++11(廃止可能性あり)
(gcc 13.3.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 685 bytes
コンパイル時間 508 ms
コンパイル使用メモリ 58,188 KB
実行使用メモリ 6,944 KB
最終ジャッジ日時 2024-09-22 07:11:33
合計ジャッジ時間 964 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 10
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <bitset>
using namespace std;

int main() {
    int n;
    cin >> n;
    bitset<10> num;
    num.set();
    for (int i = 0; i < n; i++) {
        int xs[4];
        string r;
        for (int j = 0; j < 4; j++) {
            int x;
            cin >> x;
            xs[j] = x;
        }
        cin >> r;
        if (r == "YES") {
            bitset<10> yes{};
            for (int x : xs)
                yes.set(x);
            num &= yes;
        }
        else {
            for (auto x : xs)
                num.reset(x);
        }
    }
    for (int i = 0; i < 10; i++) {
        if (num[i] == 1)
            cout << i << endl;
    }
    return 0;
}
0