結果
| 問題 |
No.1689 Set Cards
|
| コンテスト | |
| ユーザー |
asumo0729
|
| 提出日時 | 2021-09-24 22:26:51 |
| 言語 | PyPy3 (7.3.15) |
| 結果 |
AC
|
| 実行時間 | 544 ms / 2,000 ms |
| コード長 | 1,142 bytes |
| コンパイル時間 | 227 ms |
| コンパイル使用メモリ | 82,380 KB |
| 実行使用メモリ | 77,012 KB |
| 最終ジャッジ日時 | 2024-07-05 10:55:03 |
| 合計ジャッジ時間 | 7,330 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 23 |
ソースコード
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)
asumo0729