結果

問題 No.1011 Infinite Stairs
ユーザー nemutainemutai
提出日時 2023-03-27 10:24:08
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 487 ms / 2,000 ms
コード長 599 bytes
コンパイル時間 4,729 ms
コンパイル使用メモリ 171,532 KB
実行使用メモリ 215,844 KB
最終ジャッジ日時 2023-10-19 14:00:34
合計ジャッジ時間 5,893 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 17 ms
9,808 KB
testcase_03 AC 319 ms
143,456 KB
testcase_04 AC 487 ms
215,844 KB
testcase_05 AC 485 ms
215,844 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 59 ms
28,376 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 18 ms
10,772 KB
testcase_11 AC 204 ms
91,184 KB
testcase_12 AC 9 ms
6,744 KB
testcase_13 AC 107 ms
49,492 KB
testcase_14 AC 11 ms
7,228 KB
testcase_15 AC 72 ms
32,928 KB
testcase_16 AC 337 ms
150,804 KB
testcase_17 AC 364 ms
160,708 KB
testcase_18 AC 144 ms
65,776 KB
testcase_19 AC 4 ms
4,484 KB
testcase_20 AC 15 ms
9,200 KB
testcase_21 AC 79 ms
37,064 KB
testcase_22 AC 302 ms
135,868 KB
testcase_23 AC 75 ms
35,352 KB
testcase_24 AC 73 ms
34,160 KB
testcase_25 AC 144 ms
65,312 KB
testcase_26 AC 38 ms
18,584 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

#define all(v) v.begin(),v.end()
using ll = long long;
using ull = unsigned long long;
using vll=vector<ll>;
using vvll = vector<vector<ll>>;
ll mod=1e9+7;

int main(){
    ll N,D,K;
    cin>>N>>D>>K;
    vvll dp(N+1,vll(D*N+3));
    dp[0][0]=1;
    vll rw(D*N+3);
    for(int i=1;i<=N;i++){
        for(int j=0;j<=N*D;j++){
            rw[j+1]=rw[j]+dp[i-1][j];
        }
        for(int j=1;j<=N*D;j++){
            dp[i][j]+=rw[j]-rw[max(0ll,j-D)];
            dp[i][j]%=mod;

            
        }
    }
    cout << dp[N][K] << endl;
}
            
0