結果

問題 No.1689 Set Cards
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-01-16 20:07:57
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 916 bytes
コンパイル時間 1,179 ms
コンパイル使用メモリ 111,372 KB
実行使用メモリ 19,564 KB
最終ジャッジ日時 2023-08-30 02:55:20
合計ジャッジ時間 5,622 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 3 ms
4,376 KB
testcase_03 RE -
testcase_04 RE -
testcase_05 RE -
testcase_06 AC 3 ms
4,380 KB
testcase_07 RE -
testcase_08 AC 2 ms
4,380 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 AC 25 ms
19,200 KB
testcase_14 AC 25 ms
19,216 KB
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 RE -
testcase_19 RE -
testcase_20 RE -
testcase_21 AC 28 ms
19,220 KB
testcase_22 AC 27 ms
19,156 KB
testcase_23 RE -
testcase_24 RE -
testcase_25 RE -
権限があれば一括ダウンロードができます

ソースコード

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;
            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