結果

問題 No.801 エレベーター
ユーザー asdf1asdf1
提出日時 2019-03-18 00:19:59
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 259 ms / 2,000 ms
コード長 1,558 bytes
コンパイル時間 1,225 ms
コンパイル使用メモリ 146,224 KB
実行使用メモリ 89,528 KB
最終ジャッジ日時 2023-09-22 16:12:20
合計ジャッジ時間 6,586 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,464 KB
testcase_01 AC 2 ms
7,472 KB
testcase_02 AC 2 ms
7,596 KB
testcase_03 AC 6 ms
9,288 KB
testcase_04 AC 6 ms
9,360 KB
testcase_05 AC 6 ms
9,360 KB
testcase_06 AC 7 ms
9,332 KB
testcase_07 AC 7 ms
9,336 KB
testcase_08 AC 6 ms
9,360 KB
testcase_09 AC 6 ms
9,320 KB
testcase_10 AC 6 ms
9,376 KB
testcase_11 AC 7 ms
9,324 KB
testcase_12 AC 6 ms
9,384 KB
testcase_13 AC 258 ms
89,236 KB
testcase_14 AC 259 ms
89,276 KB
testcase_15 AC 257 ms
89,008 KB
testcase_16 AC 258 ms
89,040 KB
testcase_17 AC 259 ms
89,204 KB
testcase_18 AC 258 ms
89,136 KB
testcase_19 AC 259 ms
89,188 KB
testcase_20 AC 259 ms
89,148 KB
testcase_21 AC 258 ms
89,168 KB
testcase_22 AC 258 ms
89,528 KB
testcase_23 AC 252 ms
89,276 KB
testcase_24 AC 251 ms
89,204 KB
testcase_25 AC 252 ms
89,108 KB
testcase_26 AC 252 ms
89,140 KB
testcase_27 AC 251 ms
89,112 KB
testcase_28 AC 253 ms
89,276 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
typedef long long ll;
typedef long double ld;
const int INF=1e9,MOD=1e9+7,ohara=1e6+10;
const ll LINF=1e18;
using namespace std;

#define rep(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define rrep(i,a,b) for(int i=(a);i<(b);i++)
#define rrrep(i,a,b) for(int i=(a);i>=(b);i--)
#define all(v) (v).begin(), (v).end()
#define Size(n) (n).size()
#define Cout(x) cout<<(x)<<endl
#define Cerr(x) cerr<<(x)<<endl
#define fi first
#define se second
#define P pair<ll,ll> 
#define m_p make_pair
#define V vector<ll> 

ll n,cnt,ans,a,b,c,d,tmp,tmpp,m,h,w,x,y,sum,pos,k,l[ohara],r[ohara];
ld doua;
int dy[]={1,0,-1,0};
int dx[]={0,1,0,-1};
//int dy[]={-1,0,1,-1,1,-1,0,1};
//int dx[]={-1,-1,-1,0,0,1,1,1};
string alph("abcdefghijklmnopqrstuvwxyz"),s;
bool fl;
struct edge{int to,cost;};
ll dp[4000][4000];
ll cntt=0;
ll imos[4000];

//-------------------------↓↓↓↓↓↓------------------------

int main(void){
       cin.tie(0);
    ios::sync_with_stdio(false);

    cin >> n >> m >> k;
    rep(i, m)cin >> l[i] >> r[i];

    dp[0][1] = 1;
    rrep(i, 1, k+1){
        rrep(j, 1, n+1){
            (dp[i-1][j] += dp[i-1][j-1]) %= MOD;
        }
        rep(j, n+1)imos[j] = 0;
        rep(j, m){
            tmp = dp[i-1][r[j]] - dp[i-1][l[j]-1];
            tmp %= MOD;
            (imos[l[j]] += tmp) %= MOD;
            (imos[r[j]+1] += -tmp + MOD) %= MOD;
        }
        rrep(j, 1, n+1){
            (imos[j] += imos[j-1]) %= MOD;
            (dp[i][j] += imos[j]) %= MOD;
        }
    }
    Cout(dp[k][n] % MOD);
    return 0;
}
0