結果

問題 No.1689 Set Cards
ユーザー asumo0729asumo0729
提出日時 2021-09-24 22:36:35
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 213 ms / 2,000 ms
コード長 1,408 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,048 KB
実行使用メモリ 78,816 KB
最終ジャッジ日時 2023-09-18 21:49:19
合計ジャッジ時間 5,330 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 124 ms
77,520 KB
testcase_01 AC 114 ms
77,828 KB
testcase_02 AC 125 ms
77,616 KB
testcase_03 AC 122 ms
77,812 KB
testcase_04 AC 119 ms
77,956 KB
testcase_05 AC 121 ms
77,996 KB
testcase_06 AC 122 ms
77,860 KB
testcase_07 AC 124 ms
77,828 KB
testcase_08 AC 110 ms
77,920 KB
testcase_09 AC 115 ms
77,896 KB
testcase_10 AC 116 ms
77,880 KB
testcase_11 AC 186 ms
78,124 KB
testcase_12 AC 202 ms
78,816 KB
testcase_13 AC 155 ms
78,388 KB
testcase_14 AC 205 ms
78,152 KB
testcase_15 AC 139 ms
77,640 KB
testcase_16 AC 145 ms
78,300 KB
testcase_17 AC 128 ms
77,908 KB
testcase_18 AC 211 ms
78,660 KB
testcase_19 AC 213 ms
78,084 KB
testcase_20 AC 212 ms
78,260 KB
testcase_21 AC 128 ms
77,280 KB
testcase_22 AC 129 ms
77,644 KB
testcase_23 AC 131 ms
77,436 KB
testcase_24 AC 209 ms
78,132 KB
testcase_25 AC 197 ms
78,308 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
                break
        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