結果

問題 No.2134 $\sigma$-algebra over Finite Set
ユーザー ぷらぷら
提出日時 2022-11-23 01:56:39
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 135 ms / 2,000 ms
コード長 1,136 bytes
コンパイル時間 2,604 ms
コンパイル使用メモリ 206,048 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-16 12:48:24
合計ジャッジ時間 4,140 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 77 ms
5,376 KB
testcase_02 AC 77 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 7 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 8 ms
5,376 KB
testcase_07 AC 9 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 117 ms
5,376 KB
testcase_11 AC 119 ms
5,376 KB
testcase_12 AC 135 ms
5,376 KB
testcase_13 AC 123 ms
5,376 KB
testcase_14 AC 32 ms
5,376 KB
testcase_15 AC 31 ms
5,376 KB
testcase_16 AC 25 ms
5,376 KB
testcase_17 AC 2 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

constexpr int mod = 998244353;

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int N,M;
    cin >> N >> M;
    vector<vector<int>>tmp;
    vector<int>init(N);
    iota(init.begin(),init.end(),0);
    tmp.push_back(init);
    for(int i = 0; i < M; i++) {
        int l;
        cin >> l;
        vector<int>f(N);
        for(int j = 0; j < l; j++) {
            int a;
            cin >> a;
            a--;
            f[a] = 1;
        }
        vector<vector<int>>nxt;
        for(int j = 0; j < tmp.size(); j++) {
            vector<int>a = tmp[j];
            vector<int>b,c;
            for(int k = 0; k < a.size(); k++) {
                if(!f[a[k]]) {
                    b.push_back(a[k]);
                }
                else {
                    c.push_back(a[k]);
                }
            }
            if(!b.empty()) nxt.push_back(b);
            if(!c.empty()) nxt.push_back(c);
        }
        tmp = nxt;
    }
    int ans = 1;
    for(int i = 0; i < tmp.size(); i++) {
        ans *= 2;
        ans %= mod;
    }
    cout << ans << endl;
}
0