結果

問題 No.1689 Set Cards
ユーザー asumo0729asumo0729
提出日時 2021-09-24 22:31:15
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 600 ms / 2,000 ms
コード長 1,303 bytes
コンパイル時間 280 ms
コンパイル使用メモリ 87,216 KB
実行使用メモリ 78,400 KB
最終ジャッジ日時 2023-09-18 21:46:26
合計ジャッジ時間 8,811 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 118 ms
77,876 KB
testcase_01 AC 116 ms
77,804 KB
testcase_02 AC 143 ms
77,828 KB
testcase_03 AC 132 ms
77,928 KB
testcase_04 AC 134 ms
77,804 KB
testcase_05 AC 133 ms
78,132 KB
testcase_06 AC 131 ms
78,116 KB
testcase_07 AC 124 ms
77,888 KB
testcase_08 AC 114 ms
77,416 KB
testcase_09 AC 113 ms
77,904 KB
testcase_10 AC 123 ms
78,040 KB
testcase_11 AC 579 ms
78,336 KB
testcase_12 AC 600 ms
78,400 KB
testcase_13 AC 464 ms
78,300 KB
testcase_14 AC 527 ms
77,956 KB
testcase_15 AC 255 ms
77,988 KB
testcase_16 AC 410 ms
77,776 KB
testcase_17 AC 196 ms
77,724 KB
testcase_18 AC 588 ms
78,328 KB
testcase_19 AC 347 ms
78,276 KB
testcase_20 AC 348 ms
78,100 KB
testcase_21 AC 198 ms
77,604 KB
testcase_22 AC 319 ms
77,784 KB
testcase_23 AC 324 ms
77,540 KB
testcase_24 AC 388 ms
78,216 KB
testcase_25 AC 494 ms
78,176 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()
    A.append(now[1:])

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 get in A[j]:
                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