結果

問題 No.801 エレベーター
ユーザー chocopuuchocopuu
提出日時 2019-03-19 15:59:28
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 239 ms / 2,000 ms
コード長 1,421 bytes
コンパイル時間 1,614 ms
コンパイル使用メモリ 165,144 KB
実行使用メモリ 74,552 KB
最終ジャッジ日時 2023-10-11 23:12:45
合計ジャッジ時間 6,639 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 2 ms
4,352 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 6 ms
5,440 KB
testcase_04 AC 5 ms
5,224 KB
testcase_05 AC 5 ms
5,220 KB
testcase_06 AC 6 ms
5,288 KB
testcase_07 AC 5 ms
5,340 KB
testcase_08 AC 6 ms
5,552 KB
testcase_09 AC 6 ms
5,252 KB
testcase_10 AC 6 ms
5,236 KB
testcase_11 AC 5 ms
5,288 KB
testcase_12 AC 6 ms
5,268 KB
testcase_13 AC 237 ms
74,448 KB
testcase_14 AC 237 ms
74,480 KB
testcase_15 AC 236 ms
74,216 KB
testcase_16 AC 239 ms
74,256 KB
testcase_17 AC 237 ms
74,312 KB
testcase_18 AC 237 ms
74,396 KB
testcase_19 AC 236 ms
74,552 KB
testcase_20 AC 237 ms
74,312 KB
testcase_21 AC 236 ms
74,404 KB
testcase_22 AC 236 ms
74,448 KB
testcase_23 AC 227 ms
74,292 KB
testcase_24 AC 227 ms
74,336 KB
testcase_25 AC 227 ms
74,288 KB
testcase_26 AC 228 ms
74,308 KB
testcase_27 AC 227 ms
74,288 KB
testcase_28 AC 215 ms
74,476 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define int long long
#define pb push_back
#define fi first
#define se second
#define FOR(i,n) for(int i = 0;i<n;i++)
#define rep(i,s,n) for(int i = s;i<n;i++)
#define rrep(i,s,n) for(int i = (n)-1;i>=(s);i--)
#define all(v) (v).begin(),(v).end()
#define chmin(a,b) a=min((a),(b))
#define chmax(a,b) a=max((a),(b))
#define endl '\n'
#define IOS() ios_base::sync_with_stdio(0);cin.tie(0)
typedef long long ll;
typedef pair<int,int>pint;
typedef vector<int>vint;
typedef vector<pint>vpint;
const ll MOD=1000000007,INF=1ll<<60;
typedef vector<vint>vvint;

int N,M,K;
int dp[3030][3030];
int l[3030],r[3030];

signed main() {
    IOS();
    cin>>N>>M>>K;
    rep(i,0,M){
        cin>>l[i]>>r[i];
        l[i]--;
        r[i]--;
    }
    
    dp[0][0]=1;
    rep(i,0,K){
        int s[3030]={};
        rep(j,0,N)(s[j+1]+=s[j]+dp[i][j])%=MOD;
        rep(j,0,M){
            (dp[i+1][l[j]]+=s[r[j]+1])%=MOD;
            if(l[j])(dp[i+1][l[j]]+=-s[l[j]]+MOD)%=MOD;
            (dp[i+1][r[j]+1]+=-s[r[j]+1]+MOD)%=MOD;
            if(l[j])(dp[i+1][r[j]+1]+=s[l[j]]+MOD)%=MOD;
        }
        rep(j,0,N)(dp[i+1][j+1]+=dp[i+1][j])%=MOD;
    }
    int ans=0;
    (ans+=dp[K][N-1])%=MOD;
    cout<<ans<<endl;
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    return 0;
}
0