結果
問題 | No.1521 Playing Musical Chairs Alone |
ユーザー | convexineq |
提出日時 | 2021-05-28 21:54:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 718 bytes |
コンパイル時間 | 218 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 77,056 KB |
最終ジャッジ日時 | 2024-04-25 00:04:07 |
合計ジャッジ時間 | 4,320 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 41 ms
52,224 KB |
testcase_01 | AC | 50 ms
59,904 KB |
testcase_02 | AC | 52 ms
61,184 KB |
testcase_03 | AC | 42 ms
52,224 KB |
testcase_04 | AC | 44 ms
52,224 KB |
testcase_05 | WA | - |
testcase_06 | AC | 100 ms
73,344 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | WA | - |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 42 ms
51,968 KB |
testcase_13 | AC | 53 ms
59,904 KB |
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 | AC | 180 ms
75,904 KB |
testcase_23 | WA | - |
testcase_24 | AC | 181 ms
76,160 KB |
testcase_25 | AC | 227 ms
77,056 KB |
ソースコード
def matmul(A,B): # A,B: 行列 res = [[0]*len(B[0]) for _ in [None]*len(A)] for i, resi in enumerate(res): for k, aik in enumerate(A[i]): for j,bkj in enumerate(B[k]): resi[j] += aik*bkj resi[j] %= MOD return res def matpow(A,p): #A^p mod M if p%2: return matmul(A, matpow(A,p-1)) elif p > 0: b = matpow(A,p//2) return matmul(b,b) else: return [[int(i==j) for j in range(len(A))] for i in range(len(A))] n,k,L = map(int,input().split()) MOD = 10**9+7 A = [[0]*n for _ in range(n)] for i in range(n): for j in range(1,L+1): A[i][(i+j)%n] = 1 A = matpow(A,k) for i in range(n): print(A[i][0])