結果

問題 No.1011 Infinite Stairs
ユーザー dekomori_sanaedekomori_sanae
提出日時 2020-03-24 12:43:37
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 482 ms / 2,000 ms
コード長 1,252 bytes
コンパイル時間 729 ms
コンパイル使用メモリ 86,984 KB
実行使用メモリ 427,448 KB
最終ジャッジ日時 2023-09-24 11:08:45
合計ジャッジ時間 3,719 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 9 ms
8,932 KB
testcase_03 AC 322 ms
281,580 KB
testcase_04 AC 59 ms
50,232 KB
testcase_05 AC 482 ms
427,448 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 AC 5 ms
6,160 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 4 ms
5,084 KB
testcase_11 AC 70 ms
60,072 KB
testcase_12 AC 3 ms
4,608 KB
testcase_13 AC 44 ms
37,936 KB
testcase_14 AC 2 ms
4,376 KB
testcase_15 AC 56 ms
48,460 KB
testcase_16 AC 228 ms
198,180 KB
testcase_17 AC 22 ms
19,532 KB
testcase_18 AC 136 ms
115,412 KB
testcase_19 AC 4 ms
4,752 KB
testcase_20 AC 3 ms
4,376 KB
testcase_21 AC 58 ms
48,676 KB
testcase_22 AC 112 ms
94,832 KB
testcase_23 AC 68 ms
58,148 KB
testcase_24 AC 74 ms
62,736 KB
testcase_25 AC 118 ms
101,032 KB
testcase_26 AC 26 ms
22,828 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <cstdio>
#include <string>
#include <algorithm>
#include <utility>
#include <cmath>
#include <vector>
#include <queue>
#include <set>
#include <map>
#include <numeric>
#include <functional>
using namespace std;
typedef long long ll;
typedef vector<ll> vl;
typedef vector<vector<ll>> vvl;
typedef pair<ll, ll> P;
#define rep(i, n) for(ll i = 0; i < n; i++)
#define exrep(i, a, b) for(ll i = a; i <= b; i++)
#define out(x) cout << x << endl
#define exout(x) printf("%.10f\n", x)
#define chmax(x, y) x = max(x, y)
#define chmin(x, y) x = min(x, y)
#define all(a) a.begin(), a.end()
#define rall(a) a.rbegin(), a.rend()
#define pb push_back
#define re0 return 0
const ll mod = 1000000007;
const ll INF = 1e16;
const ll MAX_N = 100010;
 
int main() {
    ll n, d, k;
    cin >> n >> d >> k;
    
    vvl dp(n+1, vl(k+1));  // dp[i][j] : i回の移動後、j段目にいる場合の数
    vvl rui(n+1, vl(k+2)); // rui[i][j+1] : sum_{0 <= x <= j | dp[i][x]}
    dp[0][0] = 1;
    rep(i, n) {
        exrep(j, 0, k) {
            rui[i][j+1] = (rui[i][j] + dp[i][j])%mod;
        }
        exrep(j, 1, k) {
            dp[i+1][j] = (rui[i][j] + mod - rui[i][j - min(j, d)])%mod;
        }
    }
    
    out(dp[n][k]);
    re0;
}
0