結果

問題 No.1689 Set Cards
ユーザー asumo0729asumo0729
提出日時 2021-09-24 22:26:51
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 609 ms / 2,000 ms
コード長 1,142 bytes
コンパイル時間 348 ms
コンパイル使用メモリ 87,104 KB
実行使用メモリ 78,380 KB
最終ジャッジ日時 2023-09-18 21:43:51
合計ジャッジ時間 9,146 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 129 ms
77,740 KB
testcase_01 AC 123 ms
77,944 KB
testcase_02 AC 155 ms
77,792 KB
testcase_03 AC 138 ms
77,728 KB
testcase_04 AC 141 ms
77,736 KB
testcase_05 AC 140 ms
77,836 KB
testcase_06 AC 139 ms
77,472 KB
testcase_07 AC 132 ms
77,728 KB
testcase_08 AC 125 ms
77,712 KB
testcase_09 AC 123 ms
77,700 KB
testcase_10 AC 130 ms
77,428 KB
testcase_11 AC 589 ms
78,184 KB
testcase_12 AC 609 ms
78,380 KB
testcase_13 AC 473 ms
78,256 KB
testcase_14 AC 531 ms
78,152 KB
testcase_15 AC 262 ms
77,936 KB
testcase_16 AC 415 ms
78,260 KB
testcase_17 AC 207 ms
77,812 KB
testcase_18 AC 602 ms
78,232 KB
testcase_19 AC 359 ms
78,220 KB
testcase_20 AC 358 ms
78,188 KB
testcase_21 AC 206 ms
77,524 KB
testcase_22 AC 330 ms
77,660 KB
testcase_23 AC 338 ms
77,848 KB
testcase_24 AC 403 ms
78,132 KB
testcase_25 AC 500 ms
78,284 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

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

N = ip()
A = []
for _ in range(N):
    now = lp()
    A.append(now[1:])

houjo = [0 for _ in range(2 ** 12)]

All = pow(2, N, mod) - 1
for i in range(2 ** 12):
    g = 0
    temp = []
    for j in range(12):
        if (i >> j) & 1:
            temp.append(j + 1)
    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] = pow(2, g, mod) - 1

for i in range(1,2 ** 12):
    one = 0
    for j in range(12):
        if (i >> j) & 1:
            one += 1

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

print(All)
0