結果

問題 No.801 エレベーター
ユーザー tunamagur0tunamagur0
提出日時 2019-08-19 23:28:18
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 758 bytes
コンパイル時間 2,040 ms
コンパイル使用メモリ 168,696 KB
実行使用メモリ 174,072 KB
最終ジャッジ日時 2024-04-15 13:34:15
合計ジャッジ時間 6,043 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 31 ms
5,376 KB
testcase_04 AC 33 ms
5,376 KB
testcase_05 AC 31 ms
5,376 KB
testcase_06 AC 33 ms
5,376 KB
testcase_07 AC 33 ms
5,376 KB
testcase_08 AC 33 ms
5,376 KB
testcase_09 AC 32 ms
5,376 KB
testcase_10 AC 31 ms
5,376 KB
testcase_11 AC 29 ms
5,376 KB
testcase_12 AC 32 ms
5,376 KB
testcase_13 TLE -
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;
#define mod 1000000007

int main(void) {
    int N, M, K;
    cin >> N >> M >> K;
    vector<int> L(M), R(M);
    for (int i = 0; i < M; i++) {
        cin >> L[i] >> R[i];
        L[i]--;
        R[i]--;
    }

    vector<vector<long long> > dp(K + 1, vector<long long>(N, 0));
    dp[0][0] = 1;

    for (int i = 1; i <= K; i++) {
        for (int k = 0; k < M; k++) {
            long long sum = 0;
            for (int l = L[k]; l <= R[k]; l++) {
                sum += dp[i - 1][l] % mod;
            }
            sum %= mod;
            for (int l = L[k]; l <= R[k]; l++) {
                dp[i][l] = (dp[i][l] + sum) % mod;
            }
        }
    }

    cout << dp[K][N - 1] << endl;
    return 0;
}
0