結果

問題 No.801 エレベーター
ユーザー asdf1asdf1
提出日時 2019-03-18 00:23:49
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 258 ms / 2,000 ms
コード長 1,584 bytes
コンパイル時間 1,134 ms
コンパイル使用メモリ 146,104 KB
実行使用メモリ 89,524 KB
最終ジャッジ日時 2023-09-22 16:13:45
合計ジャッジ時間 6,366 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,480 KB
testcase_01 AC 2 ms
7,548 KB
testcase_02 AC 3 ms
7,512 KB
testcase_03 AC 6 ms
9,556 KB
testcase_04 AC 6 ms
9,288 KB
testcase_05 AC 6 ms
9,492 KB
testcase_06 AC 6 ms
9,500 KB
testcase_07 AC 6 ms
9,364 KB
testcase_08 AC 6 ms
9,336 KB
testcase_09 AC 6 ms
9,476 KB
testcase_10 AC 6 ms
9,316 KB
testcase_11 AC 7 ms
9,288 KB
testcase_12 AC 6 ms
9,408 KB
testcase_13 AC 258 ms
89,260 KB
testcase_14 AC 257 ms
89,296 KB
testcase_15 AC 257 ms
89,064 KB
testcase_16 AC 257 ms
89,052 KB
testcase_17 AC 257 ms
89,100 KB
testcase_18 AC 255 ms
89,140 KB
testcase_19 AC 256 ms
89,188 KB
testcase_20 AC 258 ms
89,388 KB
testcase_21 AC 257 ms
89,180 KB
testcase_22 AC 257 ms
89,256 KB
testcase_23 AC 248 ms
89,120 KB
testcase_24 AC 249 ms
89,092 KB
testcase_25 AC 251 ms
89,376 KB
testcase_26 AC 250 ms
89,132 KB
testcase_27 AC 249 ms
89,024 KB
testcase_28 AC 253 ms
89,524 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;
            (imos[r[j]+1] += 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