結果

問題 No.2134 $\sigma$-algebra over Finite Set
ユーザー lddlinanlddlinan
提出日時 2023-03-31 01:08:53
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 97 ms / 2,000 ms
コード長 1,540 bytes
コンパイル時間 777 ms
コンパイル使用メモリ 86,588 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 07:54:47
合計ジャッジ時間 2,979 ms
ジャッジサーバーID
(参考情報)
judge9 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 97 ms
4,348 KB
testcase_02 AC 97 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 6 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 9 ms
4,348 KB
testcase_07 AC 10 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 1 ms
4,348 KB
testcase_10 AC 39 ms
4,348 KB
testcase_11 AC 38 ms
4,348 KB
testcase_12 AC 55 ms
4,348 KB
testcase_13 AC 80 ms
4,348 KB
testcase_14 AC 9 ms
4,348 KB
testcase_15 AC 11 ms
4,348 KB
testcase_16 AC 9 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 1 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include <map>
#include <vector>
#include <queue>
#include <deque>
#include <set>
#include <stack>
#include <algorithm>
#include <array>
#include <unordered_set>
#include <unordered_map>
#include <string>
using namespace std;

bool rcmp(int a, int b) { return a>b; }
typedef long long LL;
class mypcmp {
public:
    bool operator()(const int& a, const int& b) {
        return a<b;
    }
};


unsigned int mt[1004][40];
unsigned int rt[1004][40];
int main() {
    int n, i, m, c, j, k, r, i1, i2, a, x, ii;
    int xx;
    unsigned int mm, t;
    scanf("%d %d", &n, &m);
    k=0;
    memset(mt[k], 0xff, sizeof(mt[k]));
    k++;
    for (i=0; i<m; i++) {
        memset(mt[k], 0, sizeof(mt[k]));
        scanf("%d", &c);
        for (j=0; j<c; j++) {
            scanf("%d", &a); a--;
            mt[k][a/32]|=(1<<(a%32));
        } if (c==n) continue;
        k++;
    }
    x=(n+31)/32;
    c=0; r=1;
    for (i=0; i<n; i++) {
        memset(rt[c], 0xff, sizeof(rt[c]));
        i1=i/32; i2=i%32; mm=1<<i2;
        for (j=0; j<k; j++) {
            if (mt[j][i1]&mm) {
                for (ii=0; ii<x; ii++) rt[c][ii]&=mt[j][ii];
            } else {
                for (ii=0; ii<x; ii++) rt[c][ii]&=(~mt[j][ii]);
            }
        }
        for (j=0; j<c; j++) {
            for (ii=0; ii<x; ii++) if (rt[c][ii]!=rt[j][ii]) break;
            if (ii>=x) break;
        } if (j<c) continue;
        c++;
        r*=2; r%=998244353;
    }
    printf("%d\n", r);
    return 0;
}
0