結果

問題 No.1689 Set Cards
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-01-16 19:55:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 951 bytes
コンパイル時間 998 ms
コンパイル使用メモリ 110,288 KB
実行使用メモリ 19,448 KB
最終ジャッジ日時 2023-08-30 02:46:51
合計ジャッジ時間 3,315 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

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] = s;
    }


    vector<vector<long long>> dp(N+1, vector<long long>(M));
    for (int i=1; i<=N; i++){
        dp[i][S[i]]++;
    }

    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][0] << endl;

    return 0;
}
0