結果

問題 No.1689 Set Cards
ユーザー KudeKude
提出日時 2021-09-25 00:02:29
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 106 ms / 2,000 ms
コード長 470 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 87,328 KB
実行使用メモリ 76,824 KB
最終ジャッジ日時 2023-09-18 22:30:18
合計ジャッジ時間 3,897 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
76,164 KB
testcase_01 AC 86 ms
76,244 KB
testcase_02 AC 86 ms
76,316 KB
testcase_03 AC 86 ms
76,300 KB
testcase_04 AC 86 ms
76,300 KB
testcase_05 AC 86 ms
76,484 KB
testcase_06 AC 84 ms
76,328 KB
testcase_07 AC 84 ms
76,296 KB
testcase_08 AC 86 ms
76,244 KB
testcase_09 AC 85 ms
76,328 KB
testcase_10 AC 86 ms
76,224 KB
testcase_11 AC 106 ms
76,692 KB
testcase_12 AC 103 ms
76,588 KB
testcase_13 AC 99 ms
76,600 KB
testcase_14 AC 99 ms
76,728 KB
testcase_15 AC 90 ms
76,540 KB
testcase_16 AC 95 ms
76,824 KB
testcase_17 AC 88 ms
76,204 KB
testcase_18 AC 103 ms
76,484 KB
testcase_19 AC 103 ms
76,620 KB
testcase_20 AC 102 ms
76,492 KB
testcase_21 AC 94 ms
76,640 KB
testcase_22 AC 96 ms
76,484 KB
testcase_23 AC 95 ms
76,736 KB
testcase_24 AC 104 ms
76,684 KB
testcase_25 AC 102 ms
76,604 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353
n = int(input())
m = 12
d = [0] * (1 << m)
for _ in range(n):
    _, *c = map(int, input().split())
    s = sum(1 << x - 1 for x in c)
    d[s] += 1
for k in range(m):
    for s in range(1 << m):
        if s >> k & 1:
            d[s ^ 1 << k] += d[s]
for s in range(1 << m):
    d[s] = pow(2, d[s], MOD)
for k in range(m):
    for s in range(1 << m):
        if s >> k & 1:
            d[s ^ 1 << k] -= d[s]
            d[s ^ 1 << k] %= MOD
print(d[0])
0