結果

問題 No.801 エレベーター
ユーザー misora192misora192
提出日時 2020-05-21 09:05:36
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 926 bytes
コンパイル時間 1,490 ms
コンパイル使用メモリ 166,488 KB
実行使用メモリ 74,056 KB
最終ジャッジ日時 2024-04-09 23:15:29
合計ジャッジ時間 4,734 ms
ジャッジサーバーID
(参考情報)
judge2 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,816 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 3 ms
6,940 KB
testcase_06 AC 3 ms
6,940 KB
testcase_07 AC 4 ms
6,948 KB
testcase_08 AC 3 ms
6,944 KB
testcase_09 AC 3 ms
6,940 KB
testcase_10 AC 3 ms
6,944 KB
testcase_11 AC 4 ms
6,944 KB
testcase_12 AC 3 ms
6,940 KB
testcase_13 AC 150 ms
73,880 KB
testcase_14 WA -
testcase_15 AC 152 ms
73,532 KB
testcase_16 AC 148 ms
73,648 KB
testcase_17 AC 150 ms
73,576 KB
testcase_18 AC 153 ms
73,624 KB
testcase_19 AC 151 ms
73,696 KB
testcase_20 AC 149 ms
73,664 KB
testcase_21 AC 155 ms
73,680 KB
testcase_22 AC 152 ms
73,820 KB
testcase_23 AC 134 ms
73,748 KB
testcase_24 AC 137 ms
73,480 KB
testcase_25 AC 135 ms
73,492 KB
testcase_26 AC 135 ms
73,808 KB
testcase_27 AC 136 ms
73,728 KB
testcase_28 AC 156 ms
74,056 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define rep(i,n) for(int i=(0);i<(n);i++)

using namespace std;

typedef long long ll;

template<class T> bool chmax(T &a, const T &b) { if (a<b) { a=b; return 1; } return 0; }
template<class T> bool chmin(T &a, const T &b) { if (a>b) { a=b; return 1; } return 0; }

int main(){
	cin.tie(0);
	ios::sync_with_stdio(false);

	ll n, m, k;
	cin >> n >> m >> k;

	vector<ll> l(m), r(m);
	rep(i, m){
		cin >> l[i] >> r[i];
		l[i]--;
		r[i]--;
	} 

	ll MOD = 1e9 + 7;
	ll dp[k+1][n+1];
	rep(i, k+1) rep(j, n+1) dp[i][j] = 0;
	dp[0][0] = 1;

	rep(i, k){
		vector<ll> a(n+1, 0);
		rep(j, n) {
			a[j+1] = a[j] + dp[i][j];
			a[j+1] %= MOD;
		}

		rep(j, m){
			ll sm = a[r[j]+1] - a[l[j]];
			dp[i+1][l[j]] += sm;
			dp[i+1][l[j]] %= MOD;
			dp[i+1][r[j]+1] += MOD - sm;
			dp[i+1][r[j]+1] %= MOD;
		}

		rep(j, n){
			dp[i+1][j+1] += dp[i+1][j];
			dp[i+1][j+1] %= MOD;
		}
	}

	cout << dp[k][n-1] << endl;
}
0