結果
| 問題 |
No.1689 Set Cards
|
| コンテスト | |
| ユーザー |
Nachia
|
| 提出日時 | 2021-08-07 14:38:04 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 13 ms / 2,000 ms |
| コード長 | 700 bytes |
| コンパイル時間 | 1,131 ms |
| コンパイル使用メモリ | 77,576 KB |
| 最終ジャッジ日時 | 2025-01-23 16:39:45 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
using i32 = int32_t;
using i64 = int64_t;
#define rep(i,n) for(int i=0; i<(n); i++)
const i64 MOD = 998244353;
int N;
vector<int> A;
vector<i64> dp;
int main(){
cin >> N;
A.resize(N);
rep(i,N){
int k; cin >> k;
rep(j,k){
int c; cin >> c; c--;
A[i] |= (1<<c);
}
}
dp.assign(1<<12,0);
dp.back() = 1;
for(int a : A){
rep(i,dp.size()){
dp[i&a] += dp[i];
dp[i&a] %= MOD;
}
}
cout << dp[0] << "\n";
return 0;
}
struct ios_do_not_sync{
ios_do_not_sync(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
}
} ios_do_not_sync_instance;
Nachia