結果

問題 No.801 エレベーター
ユーザー sumeragifseieisumeragifseiei
提出日時 2019-03-17 22:34:58
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 212 ms / 2,000 ms
コード長 796 bytes
コンパイル時間 510 ms
コンパイル使用メモリ 65,944 KB
実行使用メモリ 74,236 KB
最終ジャッジ日時 2023-09-22 08:20:43
合計ジャッジ時間 4,937 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 5 ms
5,264 KB
testcase_04 AC 5 ms
5,248 KB
testcase_05 AC 5 ms
5,240 KB
testcase_06 AC 5 ms
5,548 KB
testcase_07 AC 5 ms
5,420 KB
testcase_08 AC 5 ms
5,464 KB
testcase_09 AC 5 ms
5,224 KB
testcase_10 AC 5 ms
5,212 KB
testcase_11 AC 4 ms
5,212 KB
testcase_12 AC 5 ms
5,240 KB
testcase_13 AC 206 ms
73,924 KB
testcase_14 AC 211 ms
74,236 KB
testcase_15 AC 205 ms
73,948 KB
testcase_16 AC 205 ms
73,756 KB
testcase_17 AC 205 ms
73,844 KB
testcase_18 AC 208 ms
73,932 KB
testcase_19 AC 203 ms
73,888 KB
testcase_20 AC 204 ms
73,820 KB
testcase_21 AC 205 ms
74,064 KB
testcase_22 AC 204 ms
74,132 KB
testcase_23 AC 195 ms
73,816 KB
testcase_24 AC 195 ms
73,816 KB
testcase_25 AC 195 ms
73,952 KB
testcase_26 AC 196 ms
73,844 KB
testcase_27 AC 196 ms
73,792 KB
testcase_28 AC 212 ms
73,936 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
typedef long long ll;
ll n, m, k, l[3010], r[3010], dp[3010][3010];
const ll mod = 1000000007;

int main(void)
{
	cin >> n >> m >> k;
	for (ll i = 0; i < m; i++)
	{
		cin >> l[i] >> r[i];
	}
	for (ll i = 1; i <= n; i++)
	{
		dp[0][i] = 1;
	}
	for (ll i = 1; i <= k; i++)
	{
		for (ll j = 0; j < m; j++)
		{
			(dp[i][l[j]] += (mod + dp[i - 1][r[j]] - dp[i - 1][l[j] - 1])) %= mod;
			dp[i][r[j] + 1] += mod;
			(dp[i][r[j] + 1] -= (mod + dp[i - 1][r[j]] - dp[i - 1][l[j] - 1])) %= mod;
		}
		for (ll j = 1; j < n; j++)
		{
			(dp[i][j + 1] += dp[i][j]) %= mod;
		}
		for (ll j = 1; j < n; j++)
		{
			(dp[i][j + 1] += dp[i][j]) %= mod;
		}
	}
	cout << (mod + dp[k][n] - dp[k][n - 1]) % mod << endl;
}
0