結果

問題 No.2134 $\sigma$-algebra over Finite Set
ユーザー 👑 rin204rin204
提出日時 2022-11-25 22:31:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 842 bytes
コンパイル時間 2,136 ms
コンパイル使用メモリ 202,584 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-07-25 10:42:39
合計ジャッジ時間 3,983 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 187 ms
4,376 KB
testcase_02 AC 188 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 8 ms
4,376 KB
testcase_07 AC 9 ms
4,376 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 1 ms
4,376 KB
testcase_10 WA -
testcase_11 AC 20 ms
4,380 KB
testcase_12 AC 49 ms
4,376 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 14 ms
4,376 KB
testcase_16 WA -
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
const long long MOD = 998244353;

long long modpow(long long a, long long b){
	long long ret = 1;
	a %= MOD;
	while(b){
		if(b & 1){
			ret *= a;
			ret %= MOD;
		}
		a *= a;
		a %= MOD;
		b >>= 1;
	}
	return ret;
}

void solve(){
	int n, m;
	cin >> n >> m;
	vector<bitset<1010>> bs(m + 1);
	int l, a;
	for(int i = 0; i < m; i++){
		cin >> l;
		while(l--){
			cin >> a;
			bs[i][a - 1] = 1;
		}
	}
	for(int i = 0; i < n; i++) bs[m][i] = 1;
	m++;
	int c = 0;
	for(int i = 0; i < n; i++){
		int ind = -1;
		for(int j = c; j < m; j++){
			if(bs[j][i]){
				ind = j;
				break;
			}
		}
		if(ind == -1) continue;
		c++;
		for(int j = 0; j < m; j++){
			if(j != ind && bs[j][i]) bs[j] ^= bs[ind];
		}
	}
	cout << modpow(2, c) << "\n";
}

int main(){
	int t;
	t = 1;
	// cin >> t;
	while(t--) solve();
}
0