結果

問題 No.2711 Connecting Lights
コンテスト
ユーザー LyricalMaestro
提出日時 2026-03-10 00:15:22
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 100 ms / 5,000 ms
コード長 888 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 296 ms
コンパイル使用メモリ 85,528 KB
実行使用メモリ 81,116 KB
最終ジャッジ日時 2026-03-10 00:15:27
合計ジャッジ時間 2,952 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge1_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

## https://yukicoder.me/problems/no/2711

MOD = 998244353

def main():
    N, M, K = map(int, input().split())

    bit_count = 2 ** N
    dp = [0] * bit_count
    for i in range(bit_count):
        dp[i] = 1

    true_bit = [0] * bit_count
    for bit in range(bit_count):
        cnt = 0
        for i in range(N):
            if bit & ( 1 << i) > 0:
                cnt += 1
        if cnt >= K:
            true_bit[bit] = 1

    for _ in range(1, M):
        new_dp = [0] * bit_count

        for bit0 in range(bit_count):
            for bit1 in range(bit_count):
                b = bit0 & bit1
                
                new_dp[bit1] += true_bit[b] * dp[bit0]
                new_dp[bit1] %= MOD
        dp = new_dp

    answer = 0
    for bit in range(bit_count):
        answer += dp[bit]
        answer %= MOD
    print(answer)






if __name__ == "__main__":
    main()
0