結果
問題 | No.801 エレベーター |
ユーザー |
|
提出日時 | 2021-03-19 12:33:48 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 107 ms / 2,000 ms |
コード長 | 1,162 bytes |
コンパイル時間 | 4,171 ms |
コンパイル使用メモリ | 232,440 KB |
実行使用メモリ | 38,784 KB |
最終ジャッジ日時 | 2024-11-17 23:17:55 |
合計ジャッジ時間 | 6,650 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 26 |
ソースコード
#include <bits/stdc++.h> #define pt(sth) cout << sth << "\n" #define itr(x,c) for(auto x=c.begin();x!=c.end();x++) #define all(a) (a.begin()),(a.end()) using namespace std; #include <atcoder/all> using namespace atcoder; typedef long long ll; typedef pair<ll, ll> pll; template<class T>bool chmax(T &a, const T &b) {if(a<b) {a=b; return 1;} return 0;} template<class T>bool chmin(T &a, const T &b) {if(b<a) {a=b; return 1;} return 0;} static const ll INF=1e18; static const ll MAX=101010; //static const ll MOD=1e9+7; static const ll MOD=998244353; //vector<ll> a(N); //for(i=0;i<N;i++) cin>>a[i]; typedef vector<modint1000000007> v1d; typedef vector<v1d> v2d; typedef vector<v2d> v3d; int main(void) { ll i,j,k; ll N,M,K;cin>>N>>M>>K; v2d dp(K+5,v1d(N+5,0)); dp[0][1]=1; vector<ll> l(M),r(M); for(i=0;i<M;i++) cin>>l[i]>>r[i]; for(k=0;k<K;k++){ v1d sum(N+1,0); for(i=1;i<=N;i++) sum[i]=sum[i-1]+dp[k][i]; for(i=0;i<M;i++){ modint1000000007 t=sum[r[i]]-sum[l[i]-1]; dp[k+1][l[i]]+=t; dp[k+1][r[i]+1]-=t; } for(i=1;i<N;i++) dp[k+1][i+1]+=dp[k+1][i]; } pt(dp[K][N].val()); }