結果
| 問題 |
No.2134 $\sigma$-algebra over Finite Set
|
| コンテスト | |
| ユーザー |
chro_96
|
| 提出日時 | 2022-11-26 11:08:14 |
| 言語 | C (gcc 13.3.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,610 bytes |
| コンパイル時間 | 394 ms |
| コンパイル使用メモリ | 31,616 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-10-02 14:45:25 |
| 合計ジャッジ時間 | 2,148 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 12 WA * 5 |
ソースコード
#include <stdio.h>
#include <stdlib.h>
typedef struct arr {
int n;
long long *a;
} arr;
int cmp_arr (const void *ap, const void *bp) {
arr a = *(arr *)ap;
arr b = *(arr *)bp;
int idx = 0;
while (idx < a.n && idx < b.n) {
if (a.a[idx] < b.a[idx]) {
return -1;
}
if (a.a[idx] > b.a[idx]) {
return 1;
}
idx++;
}
if (a.n < b.n) {
return -1;
}
if (a.n > b.n) {
return 1;
}
return 0;
}
long long power_mod (long long a, long long b, long long mod_num) {
long long ans = 1LL;
if (b > 0LL) {
ans = power_mod(a, b/2LL, mod_num);
ans = (ans * ans) % mod_num;
if (b%2LL == 1LL) {
ans = (ans *a) % mod_num;
}
}
return ans;
}
int main () {
int n = 0;
int m = 0;
int l = 0;
int a = 0;
int res = 0;
int ans = 0;
long long mod_num = 998244353LL;
arr inc[1000] = {};
long long work[20000] = {};
res = scanf("%d", &n);
res = scanf("%d", &m);
for (int i = 0; i < n; i++) {
inc[i].n = 1+m/60;
inc[i].a = work+((1+m/60)*i);
}
for (int i = 0; i < m; i++) {
res = scanf("%d", &l);
for (int j = 0; j < l; j++) {
res = scanf("%d", &a);
a--;
inc[a].a[i/60] |= (1LL<<((long long)(i%60)));
}
}
qsort(inc, n, sizeof(arr), cmp_arr);
ans = n;
for (int i = 1; i < n; i++) {
int is_ok = 1;
for (int j = 0; j < m; j++) {
if (inc[i-1].a[j] != inc[i].a[j]) {
is_ok = 0;
}
}
if (is_ok > 0) {
ans--;
}
}
printf("%lld\n", power_mod(2LL, (long long)ans, mod_num));
return 0;
}
chro_96