結果

問題 No.2711 Connecting Lights
ユーザー navel_tosnavel_tos
提出日時 2024-03-31 16:56:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 675 bytes
コンパイル時間 151 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 82,136 KB
最終ジャッジ日時 2024-03-31 16:56:17
合計ジャッジ時間 3,348 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,460 KB
testcase_01 AC 38 ms
53,460 KB
testcase_02 AC 46 ms
62,120 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 50 ms
64,212 KB
testcase_06 AC 45 ms
59,844 KB
testcase_07 AC 45 ms
59,988 KB
testcase_08 AC 49 ms
62,120 KB
testcase_09 AC 167 ms
79,340 KB
testcase_10 AC 45 ms
64,136 KB
testcase_11 AC 57 ms
70,356 KB
testcase_12 AC 62 ms
70,324 KB
testcase_13 AC 56 ms
68,456 KB
testcase_14 AC 43 ms
62,116 KB
testcase_15 AC 67 ms
68,284 KB
testcase_16 AC 60 ms
64,212 KB
testcase_17 AC 50 ms
64,200 KB
testcase_18 AC 51 ms
64,208 KB
testcase_19 AC 46 ms
64,132 KB
testcase_20 AC 66 ms
72,528 KB
testcase_21 AC 49 ms
64,200 KB
testcase_22 AC 44 ms
59,988 KB
testcase_23 AC 44 ms
62,236 KB
testcase_24 AC 84 ms
72,556 KB
testcase_25 AC 135 ms
78,444 KB
testcase_26 AC 239 ms
82,136 KB
testcase_27 AC 91 ms
82,056 KB
testcase_28 AC 266 ms
82,136 KB
testcase_29 AC 47 ms
68,416 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#MMA Contest 018 F

N, M, K = map(int, input().split())
MOD = 998244353
assert 1 <= K <= N <= 5 and 1 <= M <= 2 * 10 ** 4

#遷移先を前計算
sub = [[] for _ in range(1 << N)]
has_bit = lambda S, x: S >> x & 1
L = [S for S in range(1 << N) if S.bit_count() >= K]
for S in L:
    for T in L:
        if sum(has_bit(S, i) & has_bit(T, i) for i in range(N)) >= K:
            sub[S].append(T)

#DP[i][S]: i列目を決める直前であって、点灯状況がS
DP = [[0] * (1 << N) for _ in range(M + 1)]
DP[0][-1] = 1
for i in range(M):
    for S in L:
        for T in sub[S]:
            DP[i + 1][T] += DP[i][S]
            DP[i + 1][T] %= MOD
print(sum(DP[-1]) % MOD)
0