結果

問題 No.1011 Infinite Stairs
ユーザー granddaifukugranddaifuku
提出日時 2020-04-28 01:21:13
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 962 bytes
コンパイル時間 1,665 ms
コンパイル使用メモリ 169,136 KB
実行使用メモリ 215,512 KB
最終ジャッジ日時 2023-08-14 19:05:32
合計ジャッジ時間 4,242 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 6 ms
5,852 KB
testcase_03 AC 192 ms
143,204 KB
testcase_04 AC 34 ms
26,536 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 4 ms
4,576 KB
testcase_08 AC 2 ms
4,376 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 AC 27 ms
20,440 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 AC 3 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
testcase_21 AC 36 ms
26,052 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 71 ms
52,332 KB
testcase_26 AC 15 ms
12,996 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;

#define rep(i, n) for(int i = 0; i < (int)n; ++i)
#define FOR(i, a, b) for(int i = a; i < (int)b; ++i)
#define rrep(i, n) for(int i = ((int)n - 1); i >= 0; --i)

typedef long long ll;
typedef long double ld;

const ll INF = 1e18;
const int Inf = 1e9;
const double EPS = 1e-9;
const int MOD = 1e9 + 7;

int main() {
    cin.tie(nullptr);
    ios::sync_with_stdio(0);
    int n, d, k;
    cin >> n >> d >> k;
    vector<vector<ll> > dp(n + 1, vector<ll>(k + 2));
    dp[0][0] = 1;
    rep (i, n) {
        rep (j, k) {
            int l, r;
            l = j + 1;
            r = j + d + 1;
            r = min(r, k + 1);
            if (l > k) continue;
            dp[i + 1][l] += dp[i][j];
            dp[i + 1][r] -= dp[i][j];
        }
        FOR (j, 1, k + 1) {
            dp[i + 1][j] += dp[i + 1][j - 1];
            dp[i + 1][j] %= MOD;
        }
    }
    cout << dp[n][k] << endl;
    
    return 0;
}

0