結果

問題 No.801 エレベーター
ユーザー eQeeQe
提出日時 2020-03-29 20:03:42
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 237 ms / 2,000 ms
コード長 916 bytes
コンパイル時間 1,948 ms
コンパイル使用メモリ 144,556 KB
実行使用メモリ 81,748 KB
最終ジャッジ日時 2023-08-30 19:57:47
合計ジャッジ時間 7,001 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 6 ms
5,316 KB
testcase_04 AC 6 ms
5,224 KB
testcase_05 AC 5 ms
5,220 KB
testcase_06 AC 5 ms
5,308 KB
testcase_07 AC 5 ms
5,284 KB
testcase_08 AC 5 ms
5,352 KB
testcase_09 AC 5 ms
5,244 KB
testcase_10 AC 5 ms
5,248 KB
testcase_11 AC 5 ms
5,284 KB
testcase_12 AC 5 ms
5,380 KB
testcase_13 AC 222 ms
81,612 KB
testcase_14 AC 222 ms
81,556 KB
testcase_15 AC 222 ms
81,500 KB
testcase_16 AC 220 ms
81,476 KB
testcase_17 AC 227 ms
81,448 KB
testcase_18 AC 223 ms
81,588 KB
testcase_19 AC 223 ms
81,512 KB
testcase_20 AC 223 ms
81,424 KB
testcase_21 AC 226 ms
81,508 KB
testcase_22 AC 221 ms
81,748 KB
testcase_23 AC 214 ms
81,400 KB
testcase_24 AC 213 ms
81,584 KB
testcase_25 AC 213 ms
81,460 KB
testcase_26 AC 214 ms
81,416 KB
testcase_27 AC 214 ms
81,292 KB
testcase_28 AC 237 ms
81,600 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <string>
#define ft first
#define sc second
#define pt(sth) cout << sth << "\n"
#define chmax(a, b) (a)=max(a, b);
#define chmin(a, b) (a)=min(a, b);
#define moC(a, s, b) (a)=((a)s(b)+MOD)%MOD
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
static const ll INF=1e18;
static const ll MAX=101010;
static const ll MOD=1e9+7;


/*
 for(i=0; i<N; i++)
   cin >> a[i];
*/

ll dp[3333][3333];

int main(void) {
  ll i, j, k;
  
  ll N, M, K;
  cin >> N >> M >> K;
  ll l[3333], r[3333];
  
  
  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