結果

問題 No.801 エレベーター
ユーザー asdf1asdf1
提出日時 2019-03-18 00:16:44
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 1,523 bytes
コンパイル時間 1,222 ms
コンパイル使用メモリ 146,008 KB
実行使用メモリ 89,560 KB
最終ジャッジ日時 2023-09-22 16:11:38
合計ジャッジ時間 5,950 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,464 KB
testcase_01 AC 3 ms
7,508 KB
testcase_02 AC 2 ms
7,512 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 AC 6 ms
9,324 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 6 ms
9,332 KB
testcase_09 AC 6 ms
9,320 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 224 ms
89,136 KB
testcase_21 AC 226 ms
89,232 KB
testcase_22 AC 224 ms
89,312 KB
testcase_23 AC 220 ms
89,168 KB
testcase_24 WA -
testcase_25 AC 219 ms
89,112 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 248 ms
89,296 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){
            (imos[l[j]] += dp[i-1][r[j]] - dp[i-1][l[j]-1]) %= MOD;
            imos[r[j]+1] -= dp[i-1][r[j]] - dp[i-1][l[j]-1];
        }
        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