結果

問題 No.1521 Playing Musical Chairs Alone
ユーザー marroncastlemarroncastle
提出日時 2021-05-28 21:25:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,483 ms / 2,000 ms
コード長 397 bytes
コンパイル時間 240 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-04-24 23:39:38
合計ジャッジ時間 20,638 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,712 KB
testcase_01 AC 129 ms
75,904 KB
testcase_02 AC 356 ms
76,288 KB
testcase_03 AC 43 ms
51,968 KB
testcase_04 AC 42 ms
51,840 KB
testcase_05 AC 887 ms
76,160 KB
testcase_06 AC 164 ms
76,032 KB
testcase_07 AC 1,135 ms
76,288 KB
testcase_08 AC 376 ms
76,160 KB
testcase_09 AC 548 ms
76,032 KB
testcase_10 AC 130 ms
76,032 KB
testcase_11 AC 1,092 ms
76,032 KB
testcase_12 AC 74 ms
76,416 KB
testcase_13 AC 196 ms
75,904 KB
testcase_14 AC 228 ms
76,416 KB
testcase_15 AC 1,277 ms
76,032 KB
testcase_16 AC 1,313 ms
76,032 KB
testcase_17 AC 1,262 ms
76,160 KB
testcase_18 AC 1,319 ms
76,032 KB
testcase_19 AC 1,389 ms
76,032 KB
testcase_20 AC 1,242 ms
76,160 KB
testcase_21 AC 1,242 ms
76,288 KB
testcase_22 AC 1,483 ms
76,032 KB
testcase_23 AC 1,292 ms
76,032 KB
testcase_24 AC 1,410 ms
76,672 KB
testcase_25 AC 812 ms
76,032 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

N, K, L = map(int, input().split())
dp = [1] + [0]*(N-1)
MOD = 10**9+7
for _ in range(K):
  new_dp = [0]*N
  cum = sum(dp[:L-1])
  for i in range(L,N):
    cum += dp[i-1]
    cum %= MOD
    new_dp[i] += cum
    new_dp[i] %= MOD
    cum -= dp[i-L]
  for i in range(L):
    cum += dp[i-1]
    cum %= MOD
    new_dp[i] += cum
    new_dp[i] %= MOD
    cum -= dp[i-L]
  dp = new_dp
print(*dp, sep='\n')
0