結果

問題 No.801 エレベーター
ユーザー tempura_pptempura_pp
提出日時 2019-03-14 04:02:11
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 186 ms / 2,000 ms
コード長 760 bytes
コンパイル時間 571 ms
コンパイル使用メモリ 70,852 KB
実行使用メモリ 74,468 KB
最終ジャッジ日時 2023-09-07 06:22:30
合計ジャッジ時間 5,619 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 5 ms
5,164 KB
testcase_04 AC 5 ms
5,316 KB
testcase_05 AC 5 ms
5,144 KB
testcase_06 AC 5 ms
5,276 KB
testcase_07 AC 5 ms
5,356 KB
testcase_08 AC 5 ms
5,320 KB
testcase_09 AC 5 ms
5,216 KB
testcase_10 AC 5 ms
5,296 KB
testcase_11 AC 5 ms
5,368 KB
testcase_12 AC 5 ms
5,304 KB
testcase_13 AC 185 ms
74,424 KB
testcase_14 AC 184 ms
74,468 KB
testcase_15 AC 186 ms
74,156 KB
testcase_16 AC 184 ms
74,224 KB
testcase_17 AC 184 ms
74,252 KB
testcase_18 AC 185 ms
74,336 KB
testcase_19 AC 186 ms
74,304 KB
testcase_20 AC 186 ms
74,360 KB
testcase_21 AC 185 ms
74,388 KB
testcase_22 AC 184 ms
74,408 KB
testcase_23 AC 180 ms
74,236 KB
testcase_24 AC 180 ms
74,388 KB
testcase_25 AC 183 ms
74,388 KB
testcase_26 AC 179 ms
74,248 KB
testcase_27 AC 179 ms
74,260 KB
testcase_28 AC 183 ms
74,408 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<iostream>
#include<vector>
#include<assert.h>
using namespace std;
#define REP(i,m,n) for(int i=(int)(m) ; i < (int) (n) ; ++i )
#define rep(i,n) REP(i,0,n)
typedef long long ll;
const ll mod=1e9+7 ;


ll dp[3030][3030];
int main(){
	int n,m,k;
	cin>>n>>m>>k;
	assert(1<=n&&n<=3000);
	assert(1<=m&&m<=3000);
	assert(1<=k&&k<=3000);
	vector<pair<int,int>> v(m);
	for(auto &p :v){
		cin>>p.first>>p.second;
		assert(1<=p.first&&p.first<=p.second&&p.second<=n);
	}
	dp[0][1]=1;
	rep(i,k){
		rep(j,n)(dp[i][j+1]+=dp[i][j])%=mod;
		for(auto p : v){
			dp[i+1][p.first]+=dp[i][p.second]-dp[i][p.first-1]+mod;
			dp[i+1][p.second+1]+=-dp[i][p.second]+dp[i][p.first-1]+mod;
		}
		rep(j,n)(dp[i+1][j+1]+=dp[i+1][j])%=mod;
	}
	cout<<dp[k][n]<<endl;
	return 0;
}
0