結果
問題 | No.801 エレベーター |
ユーザー |
![]() |
提出日時 | 2019-03-17 22:05:09 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 59 ms / 2,000 ms |
コード長 | 912 bytes |
コンパイル時間 | 1,643 ms |
コンパイル使用メモリ | 173,304 KB |
実行使用メモリ | 74,228 KB |
最終ジャッジ日時 | 2024-07-07 23:08:56 |
合計ジャッジ時間 | 3,066 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h>using namespace std;#define REP(i,a,n) for(int i=(a); i<(int)(n); i++)#define rep(i,n) REP(i,0,n)#define FOR(it,c) for(__typeof((c).begin()) it=(c).begin(); it!=(c).end(); ++it)#define ALLOF(c) (c).begin(), (c).end()typedef long long ll;typedef unsigned long long ull;const ll MOD = 1000000007LL;ll dp[3005][3005];ll sum[3005];ll nxt[3005];int main(){int N, M, K;cin >> N >> M >> K;vector<vector<int>> v;rep(i,M){int l, r;cin >> l >> r;v.push_back({l,r});}dp[0][1] = 1;rep(i,K){sum[0] = 0;REP(j,1,3005) sum[j] = sum[j-1] + dp[i][j];rep(j,3005) nxt[j] = 0;rep(j,v.size()){ll s = sum[v[j][1]] - sum[v[j][0]-1];nxt[v[j][0]] += s;nxt[v[j][1]+1] -= s;}ll base = 0;rep(j,3005){base += nxt[j];dp[i+1][j] = base % MOD;}}cout << dp[K][N] << endl;return 0;}