結果

問題 No.1011 Infinite Stairs
ユーザー sima.tettekesima.tetteke
提出日時 2020-03-20 23:06:26
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 995 bytes
コンパイル時間 3,471 ms
コンパイル使用メモリ 177,584 KB
実行使用メモリ 15,080 KB
最終ジャッジ日時 2023-08-21 18:36:38
合計ジャッジ時間 6,859 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,768 KB
testcase_01 AC 2 ms
4,384 KB
testcase_02 AC 120 ms
15,080 KB
testcase_03 AC 47 ms
5,412 KB
testcase_04 TLE -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include "bits/stdc++.h"
 
using namespace std;
typedef long long int ll;
typedef pair<ll, ll > pi;  
typedef pair<pair<ll, ll >, ll > pii;  
vector<ll > vec;
vector<vector<ll > > vec2;
ll MOD = 1000000007;
ll INF = 1145141919454519;

int main(){

    ll N, d, K;
    cin >> N >> d >> K;
    //Nと段数
    vector<map<ll, ll > > dp(N+19);
    dp[0][0] = 1;

    for(ll i = 0; i < N; i++){
        //更新
        auto begin = dp[i].begin(), end = dp[i].end();
        for (auto iter = begin; iter != end; iter++) {
            ll now = iter->first;
            ll num = iter->second;
            //cout << now << " ";
            //遷移
            for(ll h = d; h > 0; h--){
                //枝ヶ里
                if((now + h) + (N - i - 1) * d < K) break;
                if(now + h <= K){
                    dp[i+1][now+h] += num;
                    dp[i+1][now+h] %= MOD;
                }
            }
        }  
        //cout << endl;
    }

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

}
0