結果

問題 No.1521 Playing Musical Chairs Alone
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-05-28 22:22:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 523 ms / 2,000 ms
コード長 572 bytes
コンパイル時間 515 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,928 KB
最終ジャッジ日時 2024-04-25 00:26:02
合計ジャッジ時間 7,153 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 46 ms
51,968 KB
testcase_01 AC 51 ms
59,904 KB
testcase_02 AC 57 ms
61,824 KB
testcase_03 AC 42 ms
51,840 KB
testcase_04 AC 43 ms
52,352 KB
testcase_05 AC 196 ms
76,416 KB
testcase_06 AC 158 ms
74,624 KB
testcase_07 AC 231 ms
76,416 KB
testcase_08 AC 76 ms
65,792 KB
testcase_09 AC 74 ms
66,048 KB
testcase_10 AC 58 ms
62,208 KB
testcase_11 AC 341 ms
76,544 KB
testcase_12 AC 42 ms
52,096 KB
testcase_13 AC 51 ms
59,520 KB
testcase_14 AC 62 ms
63,616 KB
testcase_15 AC 389 ms
76,416 KB
testcase_16 AC 428 ms
76,928 KB
testcase_17 AC 410 ms
76,672 KB
testcase_18 AC 380 ms
76,416 KB
testcase_19 AC 392 ms
76,416 KB
testcase_20 AC 419 ms
76,544 KB
testcase_21 AC 421 ms
76,672 KB
testcase_22 AC 399 ms
76,288 KB
testcase_23 AC 338 ms
76,288 KB
testcase_24 AC 405 ms
76,288 KB
testcase_25 AC 523 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

n,k,l = map(int,input().split())
mod = 10**9+7


base = [[0]*n for i in range(n)]
for i in range(n):
    base[i][i] = 1

A = [[0]*n for i in range(n)]
for i in range(n):
    for j in range(1,l+1):
        A[i][(i-j)%n] = 1

def calc(X,Y):
    ans = [[0]*n for i in range(n)]
    for i in range(n):
        for j in range(n):
            for x in range(n):
                ans[i][j] += X[i][x]*Y[x][j]
                ans[i][j] %= mod

    return ans


while k:
    if k%2:
        base = calc(base,A)
    A = calc(A,A)
    k //= 2

for i in range(n):
    print(base[i][0])
0