結果

問題 No.801 エレベーター
ユーザー simansiman
提出日時 2022-05-27 15:19:40
言語 C++17(clang)
(17.0.6 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,077 bytes
コンパイル時間 1,052 ms
コンパイル使用メモリ 131,144 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 19:41:51
合計ジャッジ時間 3,918 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 3 ms
4,348 KB
testcase_04 AC 3 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 WA -
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 4 ms
4,348 KB
testcase_09 AC 4 ms
4,348 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 AC 127 ms
4,348 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 AC 127 ms
4,348 KB
testcase_22 AC 127 ms
4,348 KB
testcase_23 AC 120 ms
4,348 KB
testcase_24 WA -
testcase_25 AC 121 ms
4,348 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 AC 144 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cassert>
#include <cmath>
#include <algorithm>
#include <iostream>
#include <iomanip>
#include <climits>
#include <map>
#include <queue>
#include <set>
#include <cstring>
#include <vector>

using namespace std;
typedef long long ll;

const ll MOD = 1000000007;
const int MAX_N = 3010;

ll dp[MAX_N];
ll RUI[MAX_N];
ll D[MAX_N];
int L[MAX_N];
int R[MAX_N];

int main() {
  int N, M, K;
  cin >> N >> M >> K;

  for (int i = 0; i < M; ++i) {
    cin >> L[i] >> R[i];
  }

  memset(dp, 0, sizeof(dp));
  dp[1] = 1;

  for (int i = 0; i < K; ++i) {
    memset(RUI, 0, sizeof(RUI));

    for (int j = 1; j <= N; ++j) {
      RUI[j] = dp[j] + RUI[j - 1];
      RUI[j] %= MOD;
    }

    memset(D, 0, sizeof(D));

    for (int j = 0; j < M; ++j) {
      int l = L[j];
      int r = R[j];
      ll sum = RUI[r] - RUI[l - 1];

      D[l] += sum;
      D[l] %= MOD;
      D[r + 1] -= sum;
      D[r + 1] %= MOD;
    }

    ll sum = 0;
    for (int j = 1; j <= N; ++j) {
      sum += D[j];
      sum %= MOD;
      dp[j] = sum;
    }
  }

  cout << dp[N] << endl;

  return 0;
}
0