結果

問題 No.801 エレベーター
ユーザー eQeeQe
提出日時 2019-03-18 14:45:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 1,202 bytes
コンパイル時間 1,228 ms
コンパイル使用メモリ 144,908 KB
実行使用メモリ 81,712 KB
最終ジャッジ日時 2023-09-25 11:09:01
合計ジャッジ時間 6,338 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 6 ms
5,372 KB
testcase_04 AC 5 ms
5,180 KB
testcase_05 AC 5 ms
5,184 KB
testcase_06 AC 5 ms
5,408 KB
testcase_07 AC 5 ms
5,424 KB
testcase_08 AC 6 ms
5,256 KB
testcase_09 AC 5 ms
5,312 KB
testcase_10 AC 5 ms
5,196 KB
testcase_11 AC 5 ms
5,192 KB
testcase_12 AC 5 ms
5,260 KB
testcase_13 AC 222 ms
81,536 KB
testcase_14 AC 226 ms
81,592 KB
testcase_15 AC 221 ms
81,332 KB
testcase_16 AC 222 ms
81,332 KB
testcase_17 AC 221 ms
81,388 KB
testcase_18 AC 221 ms
81,496 KB
testcase_19 AC 222 ms
81,508 KB
testcase_20 AC 224 ms
81,576 KB
testcase_21 AC 221 ms
81,448 KB
testcase_22 AC 221 ms
81,604 KB
testcase_23 AC 214 ms
81,372 KB
testcase_24 AC 214 ms
81,332 KB
testcase_25 AC 214 ms
81,436 KB
testcase_26 AC 214 ms
81,516 KB
testcase_27 AC 214 ms
81,264 KB
testcase_28 AC 237 ms
81,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define ft first
#define sc second
#define lb lower_bound
#define ub upper_bound
#define pb(t) push_back(t)
#define pt(num) cout << num << "\n"
#define chmax(a, b) (a<b ? a=b : 0)
#define chmin(a, b) (a>b ? a=b : 0)
#define max(a, b) ((a)>(b) ? (a):(b))
#define min(a, b) ((a)<(b) ? (a):(b))
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> P;
typedef map<ll, ll> Map;
static const ll INF=1e18;
static const ll MAX=1e5+7;
static const ll MOD=1e9+7;



ll dp[3333][3333]={};

int main(void) {
    ll N, M, K;
    cin >> N >> M >> K;
    ll l[3333], r[3333];
    ll i, j;
    
    for(i=0; i<M; i++) {
        cin >> l[i] >> r[i];
    }
    
    
    dp[0][1]=1;
    for(i=0; i<K; i++) {
        
        ll s[3333]={};
        for(j=1; j<=N; j++) {
            s[j]=(s[j-1]+dp[i][j])%MOD;
        }
        
        
        for(j=0; j<M; j++) {
            ll t=s[r[j]]-s[l[j]-1];
            moC(dp[i+1][l[j]], +, t);
            moC(dp[i+1][r[j]+1], -, t);
        }
        
        for(j=0; j<N; j++) {
            moC(dp[i+1][j+1], +, dp[i+1][j]);
        }
        
    }
    
    pt(dp[K][N]);
    
    
}






0