結果

問題 No.1689 Set Cards
ユーザー asumo0729asumo0729
提出日時 2021-09-24 22:34:07
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 354 ms / 2,000 ms
コード長 1,386 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,956 KB
実行使用メモリ 78,796 KB
最終ジャッジ日時 2023-09-18 21:48:22
合計ジャッジ時間 6,608 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
77,736 KB
testcase_01 AC 117 ms
77,448 KB
testcase_02 AC 130 ms
77,792 KB
testcase_03 AC 123 ms
77,840 KB
testcase_04 AC 124 ms
77,796 KB
testcase_05 AC 124 ms
78,088 KB
testcase_06 AC 122 ms
77,732 KB
testcase_07 AC 117 ms
77,972 KB
testcase_08 AC 111 ms
77,632 KB
testcase_09 AC 112 ms
77,852 KB
testcase_10 AC 116 ms
77,876 KB
testcase_11 AC 327 ms
78,040 KB
testcase_12 AC 354 ms
78,796 KB
testcase_13 AC 270 ms
78,228 KB
testcase_14 AC 317 ms
78,248 KB
testcase_15 AC 196 ms
77,852 KB
testcase_16 AC 251 ms
78,256 KB
testcase_17 AC 151 ms
77,688 KB
testcase_18 AC 342 ms
78,064 KB
testcase_19 AC 214 ms
78,164 KB
testcase_20 AC 213 ms
78,000 KB
testcase_21 AC 199 ms
77,716 KB
testcase_22 AC 205 ms
77,760 KB
testcase_23 AC 211 ms
77,696 KB
testcase_24 AC 232 ms
78,200 KB
testcase_25 AC 327 ms
78,292 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
from operator import itemgetter
from collections import defaultdict, deque
import heapq
import bisect

stdin=sys.stdin
sys.setrecursionlimit(10 ** 8)

ip=lambda: int(sp())
fp=lambda: float(sp())
lp=lambda:list(map(int,stdin.readline().split()))
sp=lambda:stdin.readline().rstrip()
Yp=lambda:print('Yes')
Np=lambda:print('No')
inf = 1 << 60
eps = 1e-9
sortkey = itemgetter(0)
mod = 998244353

def power_list(x, n, mod):
    res = [1]
    for _ in range(n):
        res.append(res[-1] * x % mod)
    return res


###############################################################

N = ip()
A = []
for _ in range(N):
    now = lp()
    res = 0
    k = now[0]
    for i in range(k):
        res ^= 2 ** now[i + 1]
    A.append(res)

houjo = [0 for _ in range(2 ** 12)]
bit = [0 for _ in range(2 ** 12)]
ruijo = power_list(2, N + 10, mod)

All = ruijo[N] - 1
for i in range(2 ** 12):
    g = 0
    temp = []
    one = 0
    for j in range(12):
        if (i >> j) & 1:
            one += 1
            temp.append(j + 1)
    bit[i] = one
    for j in range(N):
        flag = True
        for get in temp:
            if not (A[j] >> get) & 1:
                flag = False
        if flag:
            g += 1
    houjo[i] = ruijo[g] - 1

for i in range(1,2 ** 12):
    one = bit[i]

    if one & 1:
        All -= houjo[i]
    else:
        All += houjo[i]
    All %= mod

print(All)
0