結果
問題 | No.2152 [Cherry Anniversary 2] 19 Petals of Cherry |
ユーザー | Shirotsume |
提出日時 | 2022-12-09 01:22:10 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 284 ms / 1,000 ms |
コード長 | 1,043 bytes |
コンパイル時間 | 256 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 88,832 KB |
最終ジャッジ日時 | 2024-10-14 18:25:31 |
合計ジャッジ時間 | 14,116 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 206 ms
88,576 KB |
testcase_01 | AC | 221 ms
88,448 KB |
testcase_02 | AC | 196 ms
88,448 KB |
testcase_03 | AC | 267 ms
88,704 KB |
testcase_04 | AC | 283 ms
88,448 KB |
testcase_05 | AC | 247 ms
88,320 KB |
testcase_06 | AC | 274 ms
88,704 KB |
testcase_07 | AC | 246 ms
88,448 KB |
testcase_08 | AC | 240 ms
88,704 KB |
testcase_09 | AC | 227 ms
88,704 KB |
testcase_10 | AC | 246 ms
88,320 KB |
testcase_11 | AC | 243 ms
88,448 KB |
testcase_12 | AC | 231 ms
88,448 KB |
testcase_13 | AC | 276 ms
88,576 KB |
testcase_14 | AC | 242 ms
88,448 KB |
testcase_15 | AC | 241 ms
88,448 KB |
testcase_16 | AC | 228 ms
88,448 KB |
testcase_17 | AC | 278 ms
88,576 KB |
testcase_18 | AC | 272 ms
88,704 KB |
testcase_19 | AC | 279 ms
88,576 KB |
testcase_20 | AC | 284 ms
88,576 KB |
testcase_21 | AC | 237 ms
88,320 KB |
testcase_22 | AC | 277 ms
88,704 KB |
testcase_23 | AC | 230 ms
88,448 KB |
testcase_24 | AC | 275 ms
88,704 KB |
testcase_25 | AC | 272 ms
88,448 KB |
testcase_26 | AC | 250 ms
88,320 KB |
testcase_27 | AC | 273 ms
88,448 KB |
testcase_28 | AC | 220 ms
88,448 KB |
testcase_29 | AC | 213 ms
88,192 KB |
testcase_30 | AC | 215 ms
88,320 KB |
testcase_31 | AC | 215 ms
88,448 KB |
testcase_32 | AC | 216 ms
88,320 KB |
testcase_33 | AC | 214 ms
88,320 KB |
testcase_34 | AC | 217 ms
88,448 KB |
testcase_35 | AC | 225 ms
88,448 KB |
testcase_36 | AC | 276 ms
88,704 KB |
testcase_37 | AC | 267 ms
88,448 KB |
testcase_38 | AC | 272 ms
88,576 KB |
testcase_39 | AC | 274 ms
88,448 KB |
testcase_40 | AC | 277 ms
88,576 KB |
testcase_41 | AC | 268 ms
88,832 KB |
testcase_42 | AC | 267 ms
88,576 KB |
testcase_43 | AC | 264 ms
88,448 KB |
testcase_44 | AC | 263 ms
88,576 KB |
testcase_45 | AC | 264 ms
88,576 KB |
testcase_46 | AC | 265 ms
88,448 KB |
testcase_47 | AC | 193 ms
88,320 KB |
testcase_48 | AC | 275 ms
88,448 KB |
ソースコード
import sys from collections import deque, Counter sys.setrecursionlimit(5 * 10 ** 5) from pypyjit import set_param set_param('max_unroll_recursion=-1') input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 63 - 1 mod = 998244353 n = 19 A = [] for i in range(n): x = li() now = 0 for v in x[1:]: now += 2 ** (v-1) A.append(now) ppcnt = [0] * (1 << n) for i in range(1, 1<<n): ppcnt[i] = ppcnt[i//2] + i % 2 dp0 = [0] * (1<<n) dp1 = [0] * (1<<n) dp0[0] = 1 for bit in range(1<<n): cnt = ppcnt[bit] for i in range(n): if 1 & (bit >> i): cnt -= 1 if not(1 & (bit >> i)): if 1 & (A[i] >> (ppcnt[bit])): if cnt % 2: dp1[bit | (1<<i)] += dp0[bit] dp0[bit | (1<<i)] += dp1[bit] else: dp1[bit | (1<<i)] += dp1[bit] dp0[bit | (1<<i)] += dp0[bit] print(dp0[-1], dp1[-1])