結果

問題 No.801 エレベーター
ユーザー 里旬里旬
提出日時 2019-03-17 23:10:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,147 bytes
コンパイル時間 2,785 ms
コンパイル使用メモリ 200,480 KB
実行使用メモリ 13,904 KB
最終ジャッジ日時 2023-09-22 10:00:12
合計ジャッジ時間 7,974 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,396 KB
testcase_01 AC 2 ms
5,428 KB
testcase_02 AC 2 ms
5,524 KB
testcase_03 AC 106 ms
13,904 KB
testcase_04 AC 104 ms
13,664 KB
testcase_05 AC 101 ms
13,572 KB
testcase_06 AC 104 ms
13,768 KB
testcase_07 AC 106 ms
13,628 KB
testcase_08 AC 108 ms
13,644 KB
testcase_09 AC 103 ms
13,612 KB
testcase_10 AC 103 ms
13,628 KB
testcase_11 AC 100 ms
13,560 KB
testcase_12 AC 103 ms
13,712 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;

const uint64_t M = 1'000'000'007;

uint64_t mpow(uint64_t x, int y){
    if(y==0) return 1;
    if(y==1) return x%M;
    if(y%2 == 0) return mpow(x*x%M, y/2);
    return mpow(x*x%M, y/2)*x%M;
}

int main(){
    cin.tie(nullptr);
    ios::sync_with_stdio(false);
    cout.precision(12);
    cout.setf(ios_base::fixed, ios_base::floatfield);
    
    int n, m, k;
    cin >> n >> m >> k;

    int l[3000], r[3000];
    for(int i=0;i<m;i++){
        cin >> l[i] >> r[i];
        l[i]--;
        r[i]--;
    }

    static uint64_t dp[3001][3000], inc[3000][3001];
    for(int i=0;i<n;i++){
        for(int j=0;j<m;j++){
            if(l[j]<=i && i<=r[j]){
                inc[i][l[j]]++;
                inc[i][r[j]+1]--;
            }
        }
        for(int j=1;j<=n;j++) inc[i][j] += inc[i][j-1];
    }

    dp[0][0] = 1;
    for(int i=1;i<=k;i++){
        for(int pos=0;pos<n;pos++){
            for(int from=0;from<n;from++){
                dp[i][pos] += dp[i-1][from]*inc[from][pos];
                dp[i][pos] %= M;
            }
        }
    }

    cout << dp[k][n-1] << endl;
    return 0;
}
0