結果

問題 No.2134 $\sigma$-algebra over Finite Set
ユーザー lddlinanlddlinan
提出日時 2023-03-30 18:58:27
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,355 bytes
コンパイル時間 819 ms
コンパイル使用メモリ 86,736 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-22 03:58:53
合計ジャッジ時間 2,898 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 96 ms
4,348 KB
testcase_02 AC 96 ms
4,348 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 5 ms
4,348 KB
testcase_07 AC 6 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 30 ms
4,348 KB
testcase_13 AC 49 ms
4,348 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 2 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[1000][40];
int main() {
    int n, i, m, c, j, k, r, i1, i2, a, x, ii;
    unsigned int mm, t;
    scanf("%d %d", &n, &m);
    k=0;
    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;
    for (r=0, c=0; c<n; c++) {
        i1=c/32; i2=c%32; mm=1<<i2;
        for (j=r; j<k; j++) if (mt[j][i1]&mm) break;
        if (j>=k) continue;
        if (j!=r) { for (i=0; i<x; i++) { t=mt[j][i]; mt[j][i]=mt[r][i]; mt[r][i]=t; } }
        for (i=j+1; i<k; i++) {
            if (mt[i][i1]&mm) {
                for (ii=0; ii<x; ii++) mt[i][ii]^=mt[j][ii];
            }
        }
        r++;
    }
    r++;  k=1; while(r) { k<<=1; k%=998244353; r--; }
    printf("%d\n", k);
    return 0;
}
0