結果

問題 No.1689 Set Cards
ユーザー ayaoniayaoni
提出日時 2021-09-24 21:46:59
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 482 ms / 2,000 ms
コード長 556 bytes
コンパイル時間 1,495 ms
コンパイル使用メモリ 86,996 KB
実行使用メモリ 77,880 KB
最終ジャッジ日時 2023-09-18 21:07:17
合計ジャッジ時間 5,640 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
75,864 KB
testcase_01 AC 79 ms
75,652 KB
testcase_02 AC 97 ms
76,584 KB
testcase_03 AC 86 ms
76,536 KB
testcase_04 AC 85 ms
76,668 KB
testcase_05 AC 87 ms
76,728 KB
testcase_06 AC 84 ms
76,596 KB
testcase_07 AC 81 ms
76,252 KB
testcase_08 AC 77 ms
75,652 KB
testcase_09 AC 76 ms
75,612 KB
testcase_10 AC 77 ms
75,900 KB
testcase_11 AC 307 ms
77,488 KB
testcase_12 AC 293 ms
77,880 KB
testcase_13 AC 107 ms
77,648 KB
testcase_14 AC 137 ms
77,360 KB
testcase_15 AC 110 ms
77,272 KB
testcase_16 AC 140 ms
77,528 KB
testcase_17 AC 94 ms
76,600 KB
testcase_18 AC 301 ms
77,508 KB
testcase_19 AC 101 ms
77,600 KB
testcase_20 AC 101 ms
77,504 KB
testcase_21 AC 95 ms
77,232 KB
testcase_22 AC 96 ms
77,172 KB
testcase_23 AC 98 ms
77,576 KB
testcase_24 AC 482 ms
77,560 KB
testcase_25 AC 181 ms
77,492 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**7)

N = int(input())
dp = [0]*(1<<12)
dp[-1] = 1
mod = 998244353
for _ in range(N):
    new_dp = dp[:]
    X = list(map(int,input().split()))
    C = [x-1 for x in X[1:]]
    set_C = set(C)
    for i in range(1<<12):
        d = dp[i]
        if not d:
            continue
        new_id = 0
        for j in range(12):
            if (i>>j) & 1 and j in set_C:
                new_id ^= 1<<j
        new_dp[new_id] += d
        new_dp[new_id] %= mod
    dp = new_dp

ans = dp[0]
print(ans)
0