結果

問題 No.801 エレベーター
ユーザー youluoyyouluoy
提出日時 2019-03-17 21:44:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,003 bytes
コンパイル時間 1,619 ms
コンパイル使用メモリ 163,768 KB
実行使用メモリ 79,512 KB
最終ジャッジ日時 2023-09-22 04:48:24
合計ジャッジ時間 5,302 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 21 ms
79,512 KB
testcase_01 AC 21 ms
75,128 KB
testcase_02 AC 21 ms
75,148 KB
testcase_03 TLE -
testcase_04 -- -
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 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#define mk make_pair
#define pb push_back
#define pf push_front
typedef pair<int, int> pii;
#define INF (1 << 30)
#define INFL (1ll << 60ll);
#define mod 1000000007
#define se second
#define fi first

int N, M, K;
int L[3030], R[3030];
int dp[3030][3030];

int dfs(int t, int x)
{
    if(t == K){
        if(x == N){
            return 1ll;
        }
        else {
            return 0;
        }
    }
    if(~dp[t][x]){
        return dp[t][x];
    }
    int res = 0;
    for(int i = 0; i < M; i++){
        if(L[i] <= x && x <= R[i]){
            for(int j = L[i]; j <= R[i]; j++){
                res += dfs(t + 1, j);
                res %= mod;
            }
        }
    }
    return dp[t][x] = res;
}

signed main()
{
    cin >> N >> M >> K;
    for(int i = 0; i < M; i++){
        cin >> L[i] >> R[i];
    }
    memset(dp, -1ll, sizeof(dp));
    cout << dfs(0, 1) << endl;




    return 0;
}

/*



*/
0