結果

問題 No.801 エレベーター
ユーザー leaf_1415leaf_1415
提出日時 2019-03-17 22:08:56
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 250 ms / 2,000 ms
コード長 730 bytes
コンパイル時間 452 ms
コンパイル使用メモリ 59,228 KB
実行使用メモリ 73,964 KB
最終ジャッジ日時 2023-09-22 06:51:32
合計ジャッジ時間 5,823 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 6 ms
5,268 KB
testcase_04 AC 5 ms
5,424 KB
testcase_05 AC 6 ms
5,456 KB
testcase_06 AC 6 ms
5,528 KB
testcase_07 AC 6 ms
5,260 KB
testcase_08 AC 6 ms
5,264 KB
testcase_09 AC 6 ms
5,228 KB
testcase_10 AC 6 ms
5,212 KB
testcase_11 AC 6 ms
5,284 KB
testcase_12 AC 5 ms
5,332 KB
testcase_13 AC 250 ms
73,792 KB
testcase_14 AC 249 ms
73,924 KB
testcase_15 AC 246 ms
73,620 KB
testcase_16 AC 250 ms
73,640 KB
testcase_17 AC 249 ms
73,856 KB
testcase_18 AC 248 ms
73,776 KB
testcase_19 AC 247 ms
73,884 KB
testcase_20 AC 248 ms
73,720 KB
testcase_21 AC 248 ms
73,756 KB
testcase_22 AC 249 ms
73,856 KB
testcase_23 AC 241 ms
73,696 KB
testcase_24 AC 242 ms
73,964 KB
testcase_25 AC 241 ms
73,800 KB
testcase_26 AC 242 ms
73,880 KB
testcase_27 AC 241 ms
73,620 KB
testcase_28 AC 243 ms
73,840 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#define llint long long
#define mod 1000000007

using namespace std;


llint n, m, k;
llint l[3005], r[3005];
llint dp[3005][3005];
llint sum[3005];

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