結果
問題 | No.1689 Set Cards |
ユーザー | ripity |
提出日時 | 2021-11-18 17:38:56 |
言語 | Java21 (openjdk 21) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,006 bytes |
コンパイル時間 | 1,948 ms |
コンパイル使用メモリ | 74,352 KB |
実行使用メモリ | 84,808 KB |
最終ジャッジ日時 | 2023-08-27 05:06:25 |
合計ジャッジ時間 | 8,261 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge13 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 126 ms
53,836 KB |
testcase_01 | AC | 127 ms
55,552 KB |
testcase_02 | AC | 175 ms
58,024 KB |
testcase_03 | AC | 163 ms
55,576 KB |
testcase_04 | AC | 161 ms
55,592 KB |
testcase_05 | AC | 157 ms
55,584 KB |
testcase_06 | AC | 155 ms
55,768 KB |
testcase_07 | AC | 152 ms
54,588 KB |
testcase_08 | AC | 123 ms
55,624 KB |
testcase_09 | AC | 125 ms
55,952 KB |
testcase_10 | AC | 146 ms
56,040 KB |
testcase_11 | TLE | - |
testcase_12 | -- | - |
testcase_13 | -- | - |
testcase_14 | -- | - |
testcase_15 | -- | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int[][] dp = new int[1<<13][N]; int[] A = new int[N]; int mod = 998244353; for( int i = 0; i < N; i++ ) { int k = sc.nextInt(); for( int j = 0; j < k; j++ ) { int c = sc.nextInt()-1; A[i] |= 1<<c; } dp[A[i]][i]++; } for( int S = (1<<13)-1; S >= 0 ; S-- ) { for( int i = 0; i < N-1; i++ ) { for( int j = i+1; j < N; j++ ) { dp[S&A[j]][j] += dp[S][i]; dp[S&A[j]][j] %= mod; } } } int ans = 0; for( int i = 0; i < N; i++ ) { ans += dp[0][i]; ans %= mod; } System.out.println(ans); } }