結果

問題 No.1689 Set Cards
ユーザー 夜
提出日時 2021-11-17 22:36:30
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 64 ms / 2,000 ms
コード長 753 bytes
コンパイル時間 812 ms
コンパイル使用メモリ 91,352 KB
実行使用メモリ 19,448 KB
最終ジャッジ日時 2023-08-25 19:27:07
合計ジャッジ時間 3,411 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 5 ms
4,384 KB
testcase_03 AC 4 ms
4,376 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 4 ms
4,380 KB
testcase_06 AC 3 ms
4,380 KB
testcase_07 AC 3 ms
4,380 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 1 ms
4,380 KB
testcase_10 AC 3 ms
4,380 KB
testcase_11 AC 60 ms
19,352 KB
testcase_12 AC 60 ms
19,356 KB
testcase_13 AC 60 ms
19,428 KB
testcase_14 AC 59 ms
19,424 KB
testcase_15 AC 18 ms
7,852 KB
testcase_16 AC 43 ms
14,384 KB
testcase_17 AC 12 ms
6,200 KB
testcase_18 AC 61 ms
19,360 KB
testcase_19 AC 64 ms
19,428 KB
testcase_20 AC 64 ms
19,368 KB
testcase_21 AC 59 ms
19,360 KB
testcase_22 AC 61 ms
19,448 KB
testcase_23 AC 60 ms
19,408 KB
testcase_24 AC 64 ms
19,348 KB
testcase_25 AC 61 ms
19,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <string>
#include <algorithm>
#include <vector>
#include <iomanip>
#include <cmath>
#include <stdio.h>
#include <queue>
#include <deque>
#include <cstdio>
#include <set>
#include <map>
#include <bitset>
#include <stack>
#include <cctype>
using namespace std;
long long mod = 998244353;
long long dp[550][4100] = {};
int c[15];
int main() {
	int n;
	cin >> n;
	dp[0][0] = 1;
	for (int i = 1; i <= n; i++) {
		int k;
		cin >> k;
		int a = (1 << 12) - 1;
		for (int j = 0; j < k; j++) {
			cin >> c[j];
			a -= (1 << (c[j] - 1));
		}
		for (int j = 0; j < (1 << 12); j++) {
			dp[i][j] += dp[i - 1][j];
			dp[i][j] %= mod;
			dp[i][a | j] += dp[i - 1][j];
			dp[i][a | j] %= mod;
		}
	}
	cout << dp[n][(1 << 12) - 1] << endl;
}
0