結果

問題 No.1011 Infinite Stairs
ユーザー zekezeke
提出日時 2020-03-24 12:17:59
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,188 ms / 2,000 ms
コード長 1,891 bytes
コンパイル時間 859 ms
コンパイル使用メモリ 97,548 KB
実行使用メモリ 215,524 KB
最終ジャッジ日時 2023-09-24 11:08:35
合計ジャッジ時間 6,491 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 19 ms
5,924 KB
testcase_03 AC 778 ms
143,204 KB
testcase_04 AC 135 ms
26,516 KB
testcase_05 AC 1,188 ms
215,524 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 11 ms
4,540 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 7 ms
4,376 KB
testcase_11 AC 162 ms
31,644 KB
testcase_12 AC 6 ms
4,376 KB
testcase_13 AC 100 ms
20,396 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 130 ms
25,844 KB
testcase_16 AC 550 ms
100,944 KB
testcase_17 AC 48 ms
11,292 KB
testcase_18 AC 316 ms
59,508 KB
testcase_19 AC 6 ms
4,376 KB
testcase_20 AC 4 ms
4,376 KB
testcase_21 AC 131 ms
25,940 KB
testcase_22 AC 261 ms
49,244 KB
testcase_23 AC 155 ms
30,508 KB
testcase_24 AC 170 ms
33,412 KB
testcase_25 AC 281 ms
52,420 KB
testcase_26 AC 58 ms
13,136 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

/*
    Author:zeke
    
    pass System Test!
    GET AC!!
*/
#include <iostream>
#include <queue>
#include <vector>
#include <iostream>
#include <vector>
#include <string>
#include <cassert>
#include <algorithm>
#include <functional>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <deque>
#include <map>
#include <iomanip>
#include <utility>
#include <stack>
#include <bitset>
using ll = long long;
using ld = long double;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(x) (x).begin(), (x).end()
#define rep3(var, min, max) for (ll(var) = (min); (var) < (max); ++(var))
#define repi3(var, min, max) for (ll(var) = (max)-1; (var) + 1 > (min); --(var))
#define Mp(a, b) make_pair((a), (b))
#define F first
#define S second
#define Icin(s) \
    ll(s);      \
    cin >> (s);
#define Scin(s) \
    ll(s);      \
    cin >> (s);
template <class T>
bool chmax(T &a, const T &b)
{
    if (a < b)
    {
        a = b;
        return 1;
    }
    return 0;
}
template <class T>
bool chmin(T &a, const T &b)
{
    if (b < a)
    {
        a = b;
        return 1;
    }
    return 0;
}
typedef pair<ll, ll> P;
typedef vector<ll> V;
typedef vector<V> VV;
typedef vector<P> VP;
ll mod = 1e9 + 7;
ll MOD = 1e9 + 7;
ll INF = 1e18;

int main()
{
    cin.tie(0);
    ios::sync_with_stdio(false);
    ll n,d,K;
    cin>>n>>d>>K;
    VV dp(n+1,V(K+2));
    dp[0][0]=1;
    rep(i,n){
        for(int j=K;j>=0;j--){
            dp[i+1][j+1]+=dp[i][j];
            dp[i+1][min(K+1,j+d+1)]+=MOD-dp[i][j];
            dp[i+1][j+1]%=MOD;
            dp[i+1][min(K+1,j+d+1)]%=MOD;
        }
        rep3(j,1,K+2){
            dp[i+1][j]+=dp[i+1][j-1];
            dp[i+1][j]%=MOD;
            
        }
    }
 /*   rep(i,n+1){
        rep(j,K+1){
            cout<<dp[i][j]<<" ";
        }
        cout<<endl;
    }*/
    cout<<dp[n][K]<<endl;
}
0