結果

問題 No.2711 Connecting Lights
ユーザー 👑 rin204rin204
提出日時 2024-04-07 14:26:40
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 834 bytes
コンパイル時間 229 ms
コンパイル使用メモリ 81,572 KB
実行使用メモリ 64,212 KB
最終ジャッジ日時 2024-04-07 14:26:43
合計ジャッジ時間 3,065 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
53,460 KB
testcase_01 AC 38 ms
59,848 KB
testcase_02 AC 42 ms
61,960 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 34 ms
53,460 KB
testcase_06 AC 50 ms
61,996 KB
testcase_07 AC 39 ms
53,460 KB
testcase_08 AC 40 ms
61,996 KB
testcase_09 AC 51 ms
64,040 KB
testcase_10 AC 50 ms
64,044 KB
testcase_11 AC 50 ms
64,044 KB
testcase_12 AC 46 ms
64,072 KB
testcase_13 AC 48 ms
64,076 KB
testcase_14 AC 49 ms
61,996 KB
testcase_15 AC 56 ms
64,084 KB
testcase_16 AC 34 ms
53,460 KB
testcase_17 AC 33 ms
53,460 KB
testcase_18 AC 40 ms
61,996 KB
testcase_19 AC 49 ms
64,040 KB
testcase_20 AC 47 ms
64,212 KB
testcase_21 AC 33 ms
53,460 KB
testcase_22 AC 34 ms
53,460 KB
testcase_23 AC 35 ms
53,460 KB
testcase_24 AC 50 ms
64,040 KB
testcase_25 AC 50 ms
64,044 KB
testcase_26 AC 60 ms
64,032 KB
testcase_27 AC 51 ms
64,032 KB
testcase_28 AC 50 ms
64,032 KB
testcase_29 AC 48 ms
64,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

MOD = 998244353


def mat_exp_global_mod(A, B, n):
    le = len(A)
    while n > 0:
        if n & 1:
            C = [0] * le
            for i in range(le):
                for j in range(le):
                    C[i] += A[i][j] * B[j]
                    C[i] %= MOD
            B = C
        C = [[0] * le for _ in range(le)]
        for i in range(le):
            for k in range(le):
                for j in range(le):
                    C[i][j] += A[i][k] * A[k][j]
                    C[i][j] %= MOD
        A = C
        n >>= 1

    return B


n, m, k = map(int, input().split())
x = 1 << n
A = [[0] * x for _ in range(x)]

for bit1 in range(x):
    for bit2 in range(x):
        if bin(bit1 & bit2).count("1") >= k:
            A[bit1][bit2] = 1

B = [0] * x
B[-1] = 1
C = mat_exp_global_mod(A, B, m)
print(sum(C) % MOD)
0