結果

問題 No.1689 Set Cards
ユーザー とりゐ
提出日時 2021-09-24 21:46:05
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 81 ms / 2,000 ms
コード長 409 bytes
コンパイル時間 206 ms
コンパイル使用メモリ 81,664 KB
実行使用メモリ 70,144 KB
最終ジャッジ日時 2024-07-05 10:22:01
合計ジャッジ時間 2,518 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます

ソースコード

diff #

n=int(input())
cnt=[0]*(2**13)
a=[]
for i in range(n):
  b=list(map(int,input().split()))
  tmp=0
  for j in b[1:]:
    tmp+=2**j
  a.append(tmp)
mod=998244353
ans=0
for bit in range(1,2**13):
  tmp=0
  for i in a:
    if bit&i==bit:
      tmp+=1
  num=pow(2,tmp,mod)-1
  c=0
  for i in range(13):
    if bit&(1<<i)!=0:
      c+=1
  if c%2==0:
    ans-=num
  else:
    ans+=num
print((pow(2,n,mod)-ans-1)%mod)
0