結果

問題 No.1689 Set Cards
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-01-16 20:10:40
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 28 ms / 2,000 ms
コード長 921 bytes
コンパイル時間 1,070 ms
コンパイル使用メモリ 111,332 KB
実行使用メモリ 19,444 KB
最終ジャッジ日時 2023-08-30 02:57:18
合計ジャッジ時間 2,804 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 3 ms
4,380 KB
testcase_03 AC 3 ms
4,376 KB
testcase_04 AC 3 ms
4,380 KB
testcase_05 AC 3 ms
4,376 KB
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 25 ms
19,168 KB
testcase_12 AC 25 ms
19,200 KB
testcase_13 AC 25 ms
19,228 KB
testcase_14 AC 25 ms
19,444 KB
testcase_15 AC 8 ms
7,280 KB
testcase_16 AC 19 ms
14,096 KB
testcase_17 AC 6 ms
5,948 KB
testcase_18 AC 25 ms
19,164 KB
testcase_19 AC 27 ms
19,264 KB
testcase_20 AC 26 ms
19,096 KB
testcase_21 AC 28 ms
19,156 KB
testcase_22 AC 26 ms
19,148 KB
testcase_23 AC 26 ms
19,136 KB
testcase_24 AC 26 ms
19,156 KB
testcase_25 AC 25 ms
19,256 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;

const long long modc=998244353;

int main(){

    long long N, M, s, k, C, ans=0;
    M = 1LL<<12;
    cin >> N;
    vector<long long> S(N+1);
    for (int i=1; i<=N; i++){
        cin >> k;
        s = 0;
        for (int j=0; j<k; j++){
            cin >> C; C--;
            s += 1LL<<C;
        }
        S[i] = M-s-1;
    }


    vector<vector<long long>> dp(N+1, vector<long long>(M));
    dp[0][0] = 1;

    for (int i=1; i<=N; i++){
        for (int j=0; j<M; j++){
            dp[i][j] += dp[i-1][j];
            dp[i][j] %= modc;
            dp[i][j|S[i]] += dp[i-1][j];
            dp[i][j|S[i]] %= modc;
        }
    }

    cout << dp[N][M-1] << endl;

    return 0;
}
0