結果
| 問題 |
No.1011 Infinite Stairs
|
| コンテスト | |
| ユーザー |
otamay6
|
| 提出日時 | 2019-12-01 20:00:07 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 741 bytes |
| コンパイル時間 | 1,813 ms |
| コンパイル使用メモリ | 171,208 KB |
| 実行使用メモリ | 818,176 KB |
| 最終ジャッジ日時 | 2024-10-08 18:48:52 |
| 合計ジャッジ時間 | 4,865 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 MLE * 1 |
| other | MLE * 1 -- * 23 |
ソースコード
#include<bits/stdc++.h>
#define REP(i,n) for(int i=0,i##_len=(n);i<i##_len;++i)
#define rep(i,a,b) for(int i=int(a);i<int(b);++i)
#define All(x) (x).begin(),(x).end()
using namespace std;
using ll = long long;
constexpr ll mod=1e9+7;
int main(){
int N,K,d;
std::cin>>N>>K>>d;
std::vector<std::vector<ll>> dp(N+1,std::vector<ll>(N*d+1,0));
std::vector<ll> S(d*N+2,0);
dp[0][0]=1;
for(int i=0;i<N;++i){
for(int j=0;j<=d*i;++j){
S[j+1] = S[j] + dp[i][j];
}
for(int j=1;j<=d*(i+1);++j){
int ref=min(j,d*i+1);
if(j<d) dp[i+1][j]=S[ref];
else dp[i+1][j]=S[ref]-S[j-d];
dp[i+1][j]%=mod;
}
}
std::cout<<dp[N][K]<<std::endl;
}
otamay6