結果

問題 No.1689 Set Cards
ユーザー ああいいああいい
提出日時 2022-03-04 10:42:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 109 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 1,328 ms
コンパイル使用メモリ 87,152 KB
実行使用メモリ 77,544 KB
最終ジャッジ日時 2023-09-25 09:47:17
合計ジャッジ時間 6,583 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 83 ms
76,356 KB
testcase_01 AC 86 ms
76,360 KB
testcase_02 AC 84 ms
76,360 KB
testcase_03 AC 84 ms
76,128 KB
testcase_04 AC 85 ms
76,564 KB
testcase_05 AC 84 ms
76,448 KB
testcase_06 AC 83 ms
76,356 KB
testcase_07 AC 85 ms
76,356 KB
testcase_08 AC 85 ms
76,488 KB
testcase_09 AC 85 ms
76,468 KB
testcase_10 AC 83 ms
76,476 KB
testcase_11 AC 109 ms
77,544 KB
testcase_12 AC 99 ms
77,468 KB
testcase_13 AC 93 ms
76,604 KB
testcase_14 AC 101 ms
76,816 KB
testcase_15 AC 88 ms
76,712 KB
testcase_16 AC 91 ms
76,648 KB
testcase_17 AC 85 ms
76,408 KB
testcase_18 AC 102 ms
76,964 KB
testcase_19 AC 98 ms
76,900 KB
testcase_20 AC 98 ms
76,688 KB
testcase_21 AC 93 ms
76,528 KB
testcase_22 AC 90 ms
76,584 KB
testcase_23 AC 90 ms
76,572 KB
testcase_24 AC 95 ms
76,684 KB
testcase_25 AC 95 ms
76,748 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N = int(input())

dat = [0] * (1 << 12)
for _ in range(N):
    k,*l = map(int,input().split())
    bit = 0
    for i in l:
        bit |= 1 << (i-1)
    dat[bit] += 1
P = 998244353
for i in range(12):
    for bit in range(1 << 12):
        if bit & (1 << i):
            dat[bit ^ (1 << i)] += dat[bit]
ans = pow(2,N,P)-1
for bit in range(1,1 << 12):
    if bin(bit).count('1') % 2 == 0:
        c = 1
    else:
        c = -1
    tmp = pow(2,dat[bit],P) - 1
    ans = (ans + c * tmp) % P
print(ans)
0