結果

問題 No.1689 Set Cards
ユーザー lloyzlloyz
提出日時 2021-11-24 22:55:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 586 ms / 2,000 ms
コード長 488 bytes
コンパイル時間 399 ms
コンパイル使用メモリ 87,060 KB
実行使用メモリ 80,784 KB
最終ジャッジ日時 2023-09-09 15:37:20
合計ジャッジ時間 7,603 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 86 ms
76,784 KB
testcase_01 AC 80 ms
76,844 KB
testcase_02 AC 96 ms
77,392 KB
testcase_03 AC 90 ms
77,260 KB
testcase_04 AC 88 ms
77,144 KB
testcase_05 AC 88 ms
77,312 KB
testcase_06 AC 90 ms
77,136 KB
testcase_07 AC 93 ms
77,472 KB
testcase_08 AC 79 ms
76,564 KB
testcase_09 AC 80 ms
76,876 KB
testcase_10 AC 86 ms
76,832 KB
testcase_11 AC 277 ms
78,360 KB
testcase_12 AC 266 ms
78,824 KB
testcase_13 AC 213 ms
79,416 KB
testcase_14 AC 284 ms
79,600 KB
testcase_15 AC 127 ms
77,348 KB
testcase_16 AC 184 ms
78,636 KB
testcase_17 AC 112 ms
77,600 KB
testcase_18 AC 279 ms
78,328 KB
testcase_19 AC 586 ms
80,480 KB
testcase_20 AC 560 ms
80,300 KB
testcase_21 AC 168 ms
78,012 KB
testcase_22 AC 180 ms
77,980 KB
testcase_23 AC 184 ms
77,884 KB
testcase_24 AC 491 ms
80,784 KB
testcase_25 AC 415 ms
78,928 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n = int(input())
mod = 998244353

state = [set() for _ in range(12)]
for i in range(n):
    L = list(map(int, input().split()))
    k = L[0]
    L = L[1:]
    for j in range(k):
        state[L[j] - 1].add(i)

ans = 0
for bit in range(1 << 12):
    curr_state = set(range(n))
    bit_cnt = 0
    for i in range(12):
        if 1 & (bit >> i):
            curr_state &= state[i]
            bit_cnt += 1
    ans += pow(2, len(curr_state), mod) * pow(-1, bit_cnt)
    ans %= mod
print(ans)
0