結果

問題 No.2134 $\sigma$-algebra over Finite Set
ユーザー shift_aaaashift_aaaa
提出日時 2022-11-12 17:11:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 890 bytes
コンパイル時間 3,582 ms
コンパイル使用メモリ 167,312 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 12:48:00
合計ジャッジ時間 4,888 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 212 ms
5,376 KB
testcase_02 AC 213 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 9 ms
5,376 KB
testcase_07 AC 10 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 15 ms
5,376 KB
testcase_11 AC 14 ms
5,376 KB
testcase_12 AC 48 ms
5,376 KB
testcase_13 AC 106 ms
5,376 KB
testcase_14 AC 9 ms
5,376 KB
testcase_15 AC 14 ms
5,376 KB
testcase_16 AC 12 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <vector>
#include <set>
#include <iostream>
#include <bitset>
#include <unordered_set>
using namespace std;

const int MAX_N = 1010;
using bit = bitset<MAX_N>;

int main()
{
    int n, m;
    cin >> n >> m;
    vector<bit> a(m), contain(n);
    for (int i = 0; i < m; i++)
    {
        int l;
        cin >> l;
        for (int j = 0; j < l; j++)
        {
            int v;
            cin >> v;
            v--;
            a[i][v] = 1;
        }
    }

    for (int i = 0; i < n; i++)
    {
        for (int j = 0; j < m; j++)
        {
            if (a[j][i] == 1)
            {
                contain[i][j] = 1;
            }
        }
    }
    unordered_set<bit> sets;
    for (int i = 0; i < n; i++)
    {
        sets.insert(contain[i]);
    }
    int size = sets.size();
    cout << atcoder::pow_mod(2, size, 998244353) << endl;
    return 0;
}
0