結果

問題 No.801 エレベーター
ユーザー Y17Y17
提出日時 2019-03-17 23:03:36
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 116 ms / 2,000 ms
コード長 794 bytes
コンパイル時間 1,120 ms
コンパイル使用メモリ 145,032 KB
実行使用メモリ 74,164 KB
最終ジャッジ日時 2023-09-22 09:40:14
合計ジャッジ時間 4,127 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 4 ms
10,076 KB
testcase_04 AC 4 ms
10,120 KB
testcase_05 AC 4 ms
10,056 KB
testcase_06 AC 4 ms
10,068 KB
testcase_07 AC 4 ms
10,128 KB
testcase_08 AC 5 ms
10,144 KB
testcase_09 AC 4 ms
10,204 KB
testcase_10 AC 4 ms
10,196 KB
testcase_11 AC 4 ms
10,060 KB
testcase_12 AC 4 ms
10,084 KB
testcase_13 AC 116 ms
74,164 KB
testcase_14 AC 115 ms
74,032 KB
testcase_15 AC 115 ms
73,780 KB
testcase_16 AC 113 ms
73,784 KB
testcase_17 AC 114 ms
73,980 KB
testcase_18 AC 115 ms
74,036 KB
testcase_19 AC 115 ms
73,904 KB
testcase_20 AC 115 ms
73,932 KB
testcase_21 AC 116 ms
73,964 KB
testcase_22 AC 115 ms
73,992 KB
testcase_23 AC 111 ms
73,856 KB
testcase_24 AC 111 ms
73,832 KB
testcase_25 AC 110 ms
73,840 KB
testcase_26 AC 111 ms
73,864 KB
testcase_27 AC 110 ms
73,832 KB
testcase_28 AC 112 ms
74,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define int long long

#define MOD 1000000007
int dp[3010][3010];

signed main(){
    int n, m, k;
    int l[3010], r[3010];

    cin >> n >> m >> k;
    for(int i = 0;i < m;i++){
        cin >> l[i] >> r[i];
    }

    dp[0][1] = 1;

    for(int i = 1;i <= k;i++){
        int ta[3010] = {};
        for(int j = 1;j <= n;j++){
            dp[i-1][j] = (dp[i-1][j] + dp[i-1][j-1]) % MOD;
        }

        for(int j = 0;j < m;j++){
            int tmp = (MOD+dp[i-1][r[j]] - dp[i-1][l[j]-1]) % MOD;
            ta[r[j]+1] -= tmp;
            ta[l[j]] += tmp;
        }

        int imos = ta[0];
        for(int j = 1;j <= n;j++){
            imos += ta[j];
            dp[i][j] = imos % MOD;
        }
    }

    cout << dp[k][n] << endl;
}




0