結果

問題 No.1521 Playing Musical Chairs Alone
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-05-28 21:28:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 568 bytes
コンパイル時間 398 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 76,672 KB
最終ジャッジ日時 2024-04-24 23:42:25
合計ジャッジ時間 31,618 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
51,840 KB
testcase_01 AC 171 ms
76,032 KB
testcase_02 AC 317 ms
76,032 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1,348 ms
76,032 KB
testcase_06 AC 213 ms
75,904 KB
testcase_07 AC 1,719 ms
76,160 KB
testcase_08 AC 463 ms
75,776 KB
testcase_09 AC 747 ms
76,032 KB
testcase_10 AC 120 ms
76,032 KB
testcase_11 AC 1,746 ms
75,904 KB
testcase_12 AC 77 ms
75,776 KB
testcase_13 WA -
testcase_14 AC 233 ms
76,032 KB
testcase_15 TLE -
testcase_16 TLE -
testcase_17 AC 1,962 ms
76,160 KB
testcase_18 TLE -
testcase_19 TLE -
testcase_20 AC 1,887 ms
76,288 KB
testcase_21 AC 1,896 ms
76,288 KB
testcase_22 TLE -
testcase_23 TLE -
testcase_24 TLE -
testcase_25 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

dp = [0]*n
dp[0] = 1
for i in range(k):
    ndp = [0]*n
    for j in range(n):
        x = j+1
        y = j+l+1
        if x < n:
            ndp[x] += dp[j]
            ndp[x] %= mod
        if y < n:
            ndp[y] -= dp[j]
            ndp[y] %= mod
        else:
            y %= n
            ndp[0] += dp[j]
            ndp[0] %= mod
            ndp[y] -= dp[j]
            ndp[y] %= mod
    for j in range(1,n):
        ndp[j] += ndp[j-1]
        ndp[j] %= mod
    dp = ndp
for i in range(n):
    print(dp[i])
0