結果

問題 No.801 エレベーター
ユーザー AquariusAquarius
提出日時 2019-03-20 14:18:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,001 bytes
コンパイル時間 1,638 ms
コンパイル使用メモリ 168,452 KB
実行使用メモリ 78,204 KB
最終ジャッジ日時 2023-10-19 04:00:45
合計ジャッジ時間 8,161 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,044 KB
testcase_01 AC 3 ms
5,708 KB
testcase_02 AC 3 ms
5,728 KB
testcase_03 AC 233 ms
8,596 KB
testcase_04 AC 232 ms
8,580 KB
testcase_05 AC 226 ms
8,576 KB
testcase_06 AC 231 ms
8,624 KB
testcase_07 AC 237 ms
8,640 KB
testcase_08 AC 238 ms
8,664 KB
testcase_09 AC 233 ms
8,616 KB
testcase_10 AC 233 ms
8,616 KB
testcase_11 AC 229 ms
8,584 KB
testcase_12 AC 234 ms
8,648 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using PP = pair<long, long>;
const int INF = 1e9;
template <class T> T Next() { T t; cin >> t; return t; }

const int mod = 1000000007;
int n, m, k;
int dp[3001][3001];
int dq[3000][3001];

int l[3000];
int r[3000];
int main() {
  cin >> n >> m >> k;
  for (int j = 0; j < m; ++j) {
    cin >> l[j] >> r[j];
    --l[j];
  }
  
  dp[0][0] = 1; 
  for (int q = 0; q < k; ++q) {
    for (int i = 0; i < n; ++i) {
      dq[q][i + 1] = (dq[q][i] + dp[q][i]) % mod;
    }
    
    for (int j = 0; j < m; ++j) {
      int add = (dq[q][r[j]] + mod - dq[q][l[j]]) % mod;
      dp[q + 1][l[j]] = (dp[q + 1][l[j]] + add) % mod;
      dp[q + 1][r[j]] = (dp[q + 1][r[j]] + mod - add) % mod;
    }
    
    for (int i = 0; i < n; ++i) {
      dp[q + 1][i + 1] = (dp[q + 1][i + 1] + dp[q + 1][i]) % mod; 
    }
  }
  
  for (int q = 0; q <= k; ++q) {
  for (int i = 0; i <= n; ++i) {
    cerr << dp[q][i] << ' ';
  }cerr << endl;
  }
  
  cout << dp[k][n - 1] << endl;
}
0