結果
| 問題 |
No.2134 $\sigma$-algebra over Finite Set
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-03-30 19:30:59 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,541 bytes |
| コンパイル時間 | 850 ms |
| コンパイル使用メモリ | 85,916 KB |
| 最終ジャッジ日時 | 2025-02-11 19:10:52 |
|
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 WA * 11 |
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:10: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
32 | scanf("%d %d", &n, &m);
| ~~~~~^~~~~~~~~~~~~~~~~
main.cpp:38:14: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
38 | scanf("%d", &c);
| ~~~~~^~~~~~~~~~
main.cpp:40:18: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
40 | scanf("%d", &a); a--;
| ~~~~~^~~~~~~~~~
ソースコード
#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];
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;
xx=0;
for (r=0, c=0; c<n; c++) {
i1=c/32; i2=c%32; mm=1<<i2;
// printf("r is %d/%d, c is %d\n", r, k, c);
for (j=r; j<k; j++) if (mt[j][i1]&mm) break;
if (j>=k) { xx++; 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=0; i<k; i++) if (i!=j) {
if (mt[i][i1]&mm) {
for (ii=0; ii<x; ii++) mt[i][ii]^=mt[j][ii];
}
}
r++;
}
// printf("xx is %d\n", xx);
if (xx) r++;
k=1; while(r) { k<<=1; k%=998244353; r--; }
printf("%d\n", k);
return 0;
}