結果

問題 No.801 エレベーター
ユーザー tempura_pptempura_pp
提出日時 2019-03-14 04:02:11
言語 C++14
(gcc 11.2.0 + boost 1.78.0)
結果
AC  
実行時間 182 ms / 2,000 ms
コード長 760 bytes
コンパイル時間 506 ms
使用メモリ 74,576 KB
最終ジャッジ日時 2023-01-22 22:46:55
合計ジャッジ時間 5,422 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
使用メモリ
testcase_00 AC 1 ms
3,440 KB
testcase_01 AC 1 ms
3,396 KB
testcase_02 AC 2 ms
3,536 KB
testcase_03 AC 5 ms
5,348 KB
testcase_04 AC 4 ms
5,224 KB
testcase_05 AC 5 ms
5,344 KB
testcase_06 AC 5 ms
5,368 KB
testcase_07 AC 5 ms
5,332 KB
testcase_08 AC 5 ms
5,284 KB
testcase_09 AC 5 ms
5,288 KB
testcase_10 AC 5 ms
5,368 KB
testcase_11 AC 5 ms
5,288 KB
testcase_12 AC 5 ms
5,352 KB
testcase_13 AC 181 ms
74,544 KB
testcase_14 AC 181 ms
74,576 KB
testcase_15 AC 180 ms
74,276 KB
testcase_16 AC 181 ms
74,304 KB
testcase_17 AC 182 ms
74,448 KB
testcase_18 AC 182 ms
74,444 KB
testcase_19 AC 182 ms
74,416 KB
testcase_20 AC 181 ms
74,388 KB
testcase_21 AC 182 ms
74,432 KB
testcase_22 AC 181 ms
74,428 KB
testcase_23 AC 175 ms
74,344 KB
testcase_24 AC 176 ms
74,284 KB
testcase_25 AC 176 ms
74,372 KB
testcase_26 AC 177 ms
74,388 KB
testcase_27 AC 176 ms
74,268 KB
testcase_28 AC 180 ms
74,576 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