結果

問題 No.1521 Playing Musical Chairs Alone
ユーザー aaaaaaaaaa2230aaaaaaaaaa2230
提出日時 2021-05-28 21:34:47
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 572 bytes
コンパイル時間 186 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 76,544 KB
最終ジャッジ日時 2024-04-24 23:46:37
合計ジャッジ時間 28,322 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
51,840 KB
testcase_01 AC 163 ms
75,776 KB
testcase_02 AC 282 ms
76,160 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 1,237 ms
75,776 KB
testcase_06 AC 188 ms
75,904 KB
testcase_07 AC 1,574 ms
76,032 KB
testcase_08 AC 422 ms
76,160 KB
testcase_09 AC 684 ms
76,288 KB
testcase_10 AC 109 ms
75,904 KB
testcase_11 AC 1,607 ms
75,904 KB
testcase_12 AC 69 ms
75,776 KB
testcase_13 WA -
testcase_14 AC 218 ms
75,776 KB
testcase_15 AC 1,955 ms
75,904 KB
testcase_16 TLE -
testcase_17 AC 1,835 ms
76,544 KB
testcase_18 AC 1,959 ms
75,776 KB
testcase_19 TLE -
testcase_20 AC 1,777 ms
76,160 KB
testcase_21 AC 1,757 ms
75,776 KB
testcase_22 TLE -
testcase_23 AC 1,944 ms
75,776 KB
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]%mod)
0