結果

問題 No.1521 Playing Musical Chairs Alone
ユーザー googol_S0googol_S0
提出日時 2021-05-28 20:30:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 628 bytes
コンパイル時間 285 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-04-24 22:52:40
合計ジャッジ時間 5,982 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 44 ms
59,904 KB
testcase_02 AC 47 ms
61,440 KB
testcase_03 AC 36 ms
52,224 KB
testcase_04 AC 39 ms
52,736 KB
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 46 ms
60,800 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 304 ms
76,416 KB
testcase_23 WA -
testcase_24 AC 306 ms
76,416 KB
testcase_25 AC 405 ms
76,544 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N,K,L=map(int,input().split())
ANS=1
mod=10**9+7
def m(a,b):
  r=[[0]*len(b[0]) for i in range(len(a))]
  for i in range(len(a)):
    for k in range(len(b)):
      for j in range(len(b[0])):
        r[i][j]=(r[i][j]+a[i][k]*b[k][j])%mod
  return r

def p(a,n):
  r=[[0]*len(a) for i in range(len(a))]
  b=[]
  for i in range(len(a)):
    r[i][i]=1
    b.append(a[i][:])
  l=n
  while l>0:
    if l&1:
      r=m(b,r)
    b=m(b,b)
    l>>=1
  return r

X=[[0]*N for i in range(N)]
Y=[[0]*N for i in range(N)]
for i in range(N):
  for j in range(L):
    Y[(i+j)%N][i]=1
X[0][-1]=1
Z=m(p(Y,K),X)
for i in range(N):
  print(Z[i][-1])
0