結果

問題 No.1689 Set Cards
ユーザー tcltktcltk
提出日時 2021-09-30 06:15:54
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 736 bytes
コンパイル時間 365 ms
コンパイル使用メモリ 87,260 KB
実行使用メモリ 84,824 KB
最終ジャッジ日時 2023-09-24 08:35:18
合計ジャッジ時間 8,732 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 220 ms
84,172 KB
testcase_01 AC 214 ms
84,228 KB
testcase_02 AC 216 ms
84,092 KB
testcase_03 AC 218 ms
84,184 KB
testcase_04 AC 215 ms
83,900 KB
testcase_05 AC 217 ms
83,876 KB
testcase_06 AC 216 ms
83,900 KB
testcase_07 AC 219 ms
83,820 KB
testcase_08 AC 216 ms
84,124 KB
testcase_09 AC 213 ms
84,276 KB
testcase_10 AC 215 ms
84,196 KB
testcase_11 AC 232 ms
84,624 KB
testcase_12 AC 242 ms
84,824 KB
testcase_13 AC 227 ms
84,556 KB
testcase_14 AC 224 ms
84,576 KB
testcase_15 AC 220 ms
84,196 KB
testcase_16 AC 240 ms
84,628 KB
testcase_17 AC 219 ms
84,180 KB
testcase_18 AC 232 ms
84,576 KB
testcase_19 AC 259 ms
84,460 KB
testcase_20 AC 251 ms
84,288 KB
testcase_21 AC 221 ms
84,060 KB
testcase_22 AC 220 ms
83,872 KB
testcase_23 AC 224 ms
84,088 KB
testcase_24 AC 250 ms
84,616 KB
testcase_25 AC 247 ms
84,284 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python3
# from typing import *

import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq


def input():
    return sys.stdin.readline()[:-1]


# sys.setrecursionlimit(1000000)

# _INPUT = """3
# 2 1 2
# 2 1 3 
# 2 2 3

# """
# sys.stdin = io.StringIO(_INPUT)

INF = 10**10

MOD = 998244353

N = int(input())
S = []
for _ in range(N):
    dat = list(map(int, input().split()))
    s = 0
    for c in dat[1:]:
        s |= (1<<(c-1))
    S.append(s)

n = 0
for mask in range(1, 1<<12):
    k = bin(mask).count("1") 
    v = len([s for s in S if (mask & s == mask)])
    n += ((-1)**(k-1) * (pow(2, v, MOD) - 1)) % MOD

ans = (pow(2, N, MOD) - 1 - n) % MOD
print(ans)


0