結果
問題 | No.1689 Set Cards |
ユーザー |
![]() |
提出日時 | 2021-09-25 11:55:37 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 11 ms / 2,000 ms |
コード長 | 639 bytes |
コンパイル時間 | 1,262 ms |
コンパイル使用メモリ | 167,544 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-05 12:03:24 |
合計ジャッジ時間 | 2,062 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 23 |
ソースコード
#include <bits/stdc++.h> using namespace std; int main(){ int mod=998244353; int N; cin>>N; int A[N]; for(int i=0;i<N;++i){ A[i]=0; int k; cin>>k; for(int j=0;j<k;++j){ int C; cin>>C; A[i]+=(1<<(C-1)); } } int dp[(1<<12)]; fill(dp,dp+(1<<12),0); dp[(1<<12)-1]=1; for(int i=0;i<N;++i){ int temp[(1<<12)]; copy(dp,dp+(1<<12),temp); for(int j=0;j<(1<<12);++j){ temp[j&A[i]]+=dp[j]; temp[j&A[i]]%=mod; } copy(temp,temp+(1<<12),dp); } cout<<dp[0]<<endl; }