結果

問題 No.801 エレベーター
ユーザー youluoyyouluoy
提出日時 2019-03-17 23:47:57
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 171 ms / 2,000 ms
コード長 1,112 bytes
コンパイル時間 1,841 ms
コンパイル使用メモリ 164,440 KB
実行使用メモリ 75,280 KB
最終ジャッジ日時 2023-09-22 15:40:47
合計ジャッジ時間 5,886 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 4 ms
9,972 KB
testcase_04 AC 4 ms
10,080 KB
testcase_05 AC 4 ms
9,976 KB
testcase_06 AC 5 ms
10,060 KB
testcase_07 AC 5 ms
10,128 KB
testcase_08 AC 4 ms
9,996 KB
testcase_09 AC 4 ms
9,960 KB
testcase_10 AC 5 ms
10,124 KB
testcase_11 AC 4 ms
10,060 KB
testcase_12 AC 5 ms
9,968 KB
testcase_13 AC 171 ms
75,004 KB
testcase_14 AC 171 ms
74,992 KB
testcase_15 AC 170 ms
75,108 KB
testcase_16 AC 170 ms
75,084 KB
testcase_17 AC 169 ms
75,212 KB
testcase_18 AC 170 ms
75,080 KB
testcase_19 AC 171 ms
74,972 KB
testcase_20 AC 170 ms
75,008 KB
testcase_21 AC 170 ms
75,280 KB
testcase_22 AC 170 ms
75,080 KB
testcase_23 AC 164 ms
75,076 KB
testcase_24 AC 164 ms
75,000 KB
testcase_25 AC 163 ms
75,276 KB
testcase_26 AC 164 ms
75,060 KB
testcase_27 AC 164 ms
74,980 KB
testcase_28 AC 167 ms
75,008 KB
権限があれば一括ダウンロードができます

ソースコード

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 U[3030], O[3030];
int dp[3030][3030];

signed main()
{
    cin >> N >> M >> K;
    for(int i = 0; i < M; i++){
        cin >> L[i] >> R[i];
    }
    dp[0][1] = 1;
    for(int i = 0; i < K; i++){
        for(int j = 1; j <= N; j++){
            dp[i][j] += dp[i][j - 1];
            dp[i][j] %= mod;
        }
        for(int j = 0; j < M; j++){
            int sum = dp[i][R[j]] - dp[i][L[j] - 1];
            sum %= mod;
            dp[i + 1][L[j]] += sum;
            dp[i + 1][R[j] + 1] += mod - sum;
            dp[i + 1][L[j]] %= mod;
            dp[i + 1][R[j] + 1] %= mod;
        }
        for(int j = 1; j <= N; j++){
            dp[i + 1][j] += dp[i + 1][j - 1];
            dp[i + 1][j] %= mod;
        }
    }
    cout << dp[K][N] << endl;




    return 0;
}

/*



*/
0