結果

問題 No.801 エレベーター
ユーザー どららどらら
提出日時 2019-03-17 22:05:09
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 66 ms / 2,000 ms
コード長 912 bytes
コンパイル時間 1,528 ms
コンパイル使用メモリ 170,644 KB
実行使用メモリ 74,120 KB
最終ジャッジ日時 2023-09-22 06:27:39
合計ジャッジ時間 3,734 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 7 ms
11,536 KB
testcase_04 AC 7 ms
11,616 KB
testcase_05 AC 6 ms
11,588 KB
testcase_06 AC 7 ms
11,644 KB
testcase_07 AC 7 ms
11,616 KB
testcase_08 AC 6 ms
11,592 KB
testcase_09 AC 6 ms
11,596 KB
testcase_10 AC 6 ms
11,576 KB
testcase_11 AC 6 ms
11,644 KB
testcase_12 AC 6 ms
11,716 KB
testcase_13 AC 65 ms
74,012 KB
testcase_14 AC 66 ms
74,020 KB
testcase_15 AC 65 ms
73,912 KB
testcase_16 AC 66 ms
73,844 KB
testcase_17 AC 65 ms
73,952 KB
testcase_18 AC 65 ms
73,880 KB
testcase_19 AC 65 ms
73,952 KB
testcase_20 AC 65 ms
73,968 KB
testcase_21 AC 66 ms
73,944 KB
testcase_22 AC 66 ms
74,080 KB
testcase_23 AC 63 ms
73,932 KB
testcase_24 AC 63 ms
73,948 KB
testcase_25 AC 63 ms
73,940 KB
testcase_26 AC 62 ms
74,036 KB
testcase_27 AC 62 ms
74,120 KB
testcase_28 AC 63 ms
74,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)
#define rep(i,n) REP(i,0,n)
#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)
#define ALLOF(c) (c).begin(), (c).end()
typedef long long ll;
typedef unsigned long long ull;

const ll MOD = 1000000007LL;
ll dp[3005][3005];
ll sum[3005];
ll nxt[3005];

int main(){
  int N, M, K;
  cin >> N >> M >> K;
  vector<vector<int>> v;
  rep(i,M){
    int l, r;
    cin >> l >> r;
    v.push_back({l,r});
  }

  dp[0][1] = 1;
  rep(i,K){
    sum[0] = 0;
    REP(j,1,3005) sum[j] = sum[j-1] + dp[i][j];
    rep(j,3005) nxt[j] = 0;
    rep(j,v.size()){
      ll s = sum[v[j][1]] - sum[v[j][0]-1];
      nxt[v[j][0]] += s;
      nxt[v[j][1]+1] -= s;
    }
    ll base = 0;
    rep(j,3005){
      base += nxt[j];
      dp[i+1][j] = base % MOD;
    }
  }

  cout << dp[K][N] << endl;
  
  return 0;
}
0