結果
| 問題 |
No.801 エレベーター
|
| コンテスト | |
| ユーザー |
youluoy
|
| 提出日時 | 2019-03-17 21:44:57 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,003 bytes |
| コンパイル時間 | 1,605 ms |
| コンパイル使用メモリ | 166,396 KB |
| 実行使用メモリ | 150,240 KB |
| 最終ジャッジ日時 | 2024-07-07 21:32:34 |
| 合計ジャッジ時間 | 4,994 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | TLE * 1 -- * 25 |
ソースコード
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define int long long
#define mk make_pair
#define pb push_back
#define pf push_front
typedef pair<int, int> pii;
#define INF (1 << 30)
#define INFL (1ll << 60ll);
#define mod 1000000007
#define se second
#define fi first
int N, M, K;
int L[3030], R[3030];
int dp[3030][3030];
int dfs(int t, int x)
{
if(t == K){
if(x == N){
return 1ll;
}
else {
return 0;
}
}
if(~dp[t][x]){
return dp[t][x];
}
int res = 0;
for(int i = 0; i < M; i++){
if(L[i] <= x && x <= R[i]){
for(int j = L[i]; j <= R[i]; j++){
res += dfs(t + 1, j);
res %= mod;
}
}
}
return dp[t][x] = res;
}
signed main()
{
cin >> N >> M >> K;
for(int i = 0; i < M; i++){
cin >> L[i] >> R[i];
}
memset(dp, -1ll, sizeof(dp));
cout << dfs(0, 1) << endl;
return 0;
}
/*
*/
youluoy