結果

問題 No.1689 Set Cards
ユーザー roarisroaris
提出日時 2021-09-24 22:06:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 129 ms / 2,000 ms
コード長 575 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 87,088 KB
実行使用メモリ 78,176 KB
最終ジャッジ日時 2023-09-18 21:25:06
合計ジャッジ時間 4,458 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 106 ms
77,680 KB
testcase_01 AC 104 ms
77,944 KB
testcase_02 AC 104 ms
77,936 KB
testcase_03 AC 107 ms
77,824 KB
testcase_04 AC 107 ms
78,012 KB
testcase_05 AC 107 ms
77,752 KB
testcase_06 AC 108 ms
77,780 KB
testcase_07 AC 111 ms
77,692 KB
testcase_08 AC 105 ms
77,692 KB
testcase_09 AC 108 ms
77,576 KB
testcase_10 AC 105 ms
78,012 KB
testcase_11 AC 123 ms
78,044 KB
testcase_12 AC 127 ms
77,848 KB
testcase_13 AC 120 ms
77,988 KB
testcase_14 AC 129 ms
78,176 KB
testcase_15 AC 113 ms
77,660 KB
testcase_16 AC 117 ms
78,120 KB
testcase_17 AC 111 ms
77,860 KB
testcase_18 AC 127 ms
78,016 KB
testcase_19 AC 119 ms
77,924 KB
testcase_20 AC 121 ms
77,928 KB
testcase_21 AC 112 ms
77,700 KB
testcase_22 AC 114 ms
77,416 KB
testcase_23 AC 116 ms
77,588 KB
testcase_24 AC 122 ms
77,924 KB
testcase_25 AC 126 ms
78,116 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *

N = int(input())
S = []

for _ in range(N):
    kC = list(map(int, input().split()))
    Si = 0
    
    for Ci in kC[1:]:
        Si += 1<<(Ci-1)
    
    S.append(Si)

ans = 0
MOD = 998244353

for M in range(1<<12):
    c = 0
    
    for Si in S:
        if Si&M==M:
            c += 1
    
    bit_c = 0
    
    for i in range(12):
        if (M>>i)&1:
            bit_c += 1
    
    if bit_c%2==0:
        ans += pow(2, c, MOD)-1
    else:
        ans -= pow(2, c, MOD)-1
    
    ans %= MOD

print(ans)
0