結果

問題 No.1521 Playing Musical Chairs Alone
ユーザー rlangevinrlangevin
提出日時 2023-03-07 12:42:55
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 736 bytes
コンパイル時間 166 ms
コンパイル使用メモリ 81,668 KB
実行使用メモリ 76,060 KB
最終ジャッジ日時 2023-10-18 05:28:20
合計ジャッジ時間 18,995 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 45 ms
59,852 KB
testcase_01 AC 47 ms
62,044 KB
testcase_02 AC 51 ms
64,120 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 464 ms
75,500 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 39 ms
53,448 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 1,262 ms
76,060 KB
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

def Matprod(A, B, mod, N):
    temp = [0] * (N * N)
    for i in range(N):
        for k in range(N):
            for j in range(N):
                temp[i*N+j] += A[i*N+k] * B[k*N+j]
                temp[i*N+j] %= mod
    return temp

def Matpow(A, M, mod, N):
    Mat = [0] * (N * N)
    for i in range(N):
        Mat[i*N+i] = 1
         
    for i in range(64):
        if (M >> i) & 1:
            Mat = Matprod(Mat, A, mod, N)
        A = Matprod(A, A, mod, N)
    return Mat

N, K, L = map(int, input().split())
mod = 10 ** 9 + 7
Mat = [0] * (N * N)
for i in range(N):
    for j in range(N):
        if 1 <= (j - i) % N <= L:
            Mat[i*N+j] = 1

Mat = Matpow(Mat, K, mod, N)
ans = 0
for i in range(N):
    print(Mat[i*N])
0