結果

問題 No.801 エレベーター
ユーザー pockynypockyny
提出日時 2019-03-18 04:00:51
言語 C++17
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 603 ms / 2,000 ms
コード長 650 bytes
コンパイル時間 513 ms
コンパイル使用メモリ 68,272 KB
実行使用メモリ 144,284 KB
最終ジャッジ日時 2023-09-22 19:43:36
合計ジャッジ時間 11,445 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,424 KB
testcase_01 AC 2 ms
5,432 KB
testcase_02 AC 2 ms
5,436 KB
testcase_03 AC 10 ms
13,720 KB
testcase_04 AC 10 ms
13,612 KB
testcase_05 AC 10 ms
13,644 KB
testcase_06 AC 10 ms
13,608 KB
testcase_07 AC 10 ms
13,756 KB
testcase_08 AC 10 ms
13,720 KB
testcase_09 AC 10 ms
13,588 KB
testcase_10 AC 10 ms
13,608 KB
testcase_11 AC 10 ms
13,612 KB
testcase_12 AC 10 ms
13,676 KB
testcase_13 AC 600 ms
144,172 KB
testcase_14 AC 602 ms
144,284 KB
testcase_15 AC 601 ms
144,236 KB
testcase_16 AC 598 ms
144,040 KB
testcase_17 AC 601 ms
144,100 KB
testcase_18 AC 599 ms
144,224 KB
testcase_19 AC 601 ms
144,084 KB
testcase_20 AC 603 ms
144,036 KB
testcase_21 AC 598 ms
144,144 KB
testcase_22 AC 602 ms
144,228 KB
testcase_23 AC 586 ms
144,048 KB
testcase_24 AC 585 ms
144,140 KB
testcase_25 AC 586 ms
144,144 KB
testcase_26 AC 586 ms
144,056 KB
testcase_27 AC 586 ms
143,972 KB
testcase_28 AC 590 ms
144,168 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>

using namespace std;
long long dp[3002][3002] = {},sum[3002][3002] = {},l[3010],r[3010],mod = 1000000007;
int main(){
	int i,j,n,m,k;
	cin >> n >> m >> k;
	for(i=0;i<m;i++){
		cin >> l[i] >> r[i];
	}
	dp[0][1] = 1;
	for(i=1;i<=n;i++) sum[0][i] = 1;
	for(i=1;i<=k;i++){
		for(j=0;j<m;j++){
			(dp[i][l[j]] += (sum[i-1][r[j]] - sum[i-1][l[j]-1] + mod)%mod) %= mod;
			dp[i][r[j]+1] -= (sum[i-1][r[j]] - sum[i-1][l[j]-1] + mod)%mod;
			(dp[i][r[j]+1] += mod) %= mod;
		}
		sum[i][1] = dp[i][1];
		for(j=2;j<=n;j++){
			(dp[i][j] += dp[i][j-1]) %= mod;
			sum[i][j] = (sum[i][j-1] + dp[i][j])%mod;
		}
	}
	cout << dp[k][n] << endl;
}
0