結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 37 ms
53,460 KB
testcase_01 AC 37 ms
53,460 KB
testcase_02 AC 46 ms
62,116 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 49 ms
64,216 KB
testcase_06 AC 45 ms
59,840 KB
testcase_07 AC 47 ms
60,020 KB
testcase_08 AC 47 ms
62,124 KB
testcase_09 AC 160 ms
79,340 KB
testcase_10 AC 44 ms
64,144 KB
testcase_11 AC 56 ms
70,360 KB
testcase_12 AC 61 ms
70,328 KB
testcase_13 AC 56 ms
68,460 KB
testcase_14 AC 44 ms
62,120 KB
testcase_15 AC 71 ms
68,288 KB
testcase_16 AC 50 ms
64,216 KB
testcase_17 AC 50 ms
64,204 KB
testcase_18 AC 49 ms
64,216 KB
testcase_19 AC 45 ms
64,132 KB
testcase_20 AC 66 ms
72,532 KB
testcase_21 AC 50 ms
64,208 KB
testcase_22 AC 44 ms
60,020 KB
testcase_23 AC 45 ms
62,240 KB
testcase_24 AC 84 ms
72,556 KB
testcase_25 AC 140 ms
78,444 KB
testcase_26 AC 242 ms
82,140 KB
testcase_27 AC 91 ms
82,056 KB
testcase_28 AC 253 ms
82,140 KB
testcase_29 AC 47 ms
68,420 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#MMA Contest 018 F

N, M, K = map(int, input().split())
MOD = 998244353

#遷移先を前計算
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