結果
| 問題 |
No.801 エレベーター
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2021-10-08 10:55:26 |
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 2,858 bytes |
| コンパイル時間 | 4,264 ms |
| コンパイル使用メモリ | 241,600 KB |
| 実行使用メモリ | 10,656 KB |
| 最終ジャッジ日時 | 2024-07-23 03:18:33 |
| 合計ジャッジ時間 | 8,480 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 TLE * 1 -- * 15 |
ソースコード
#include <atcoder/all>
using namespace atcoder;
#include <bits/stdc++.h>
#define itr(x,c) for(auto x=c.begin();x!=c.end();x++)
#define ritr(x,c) for(auto x=c.rbegin();x!=c.rend();x++)
#define all(a) (a.begin()),(a.end())
#define rall(a) (a.rbegin()),(a.rend())
using namespace std;
using ll=long long;
using pll=pair<ll,ll>;
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;}
template<class T>istream& operator >> (istream& is, vector<T>& v) { for(T& x:v) is >> x; return is; }
template<class T>ostream& operator << (ostream& os, const vector<T>& v) {for(int i=0;i<v.size();i++) {os << v[i] << (i+1 == v.size() ? "":" ");} return os;}
template<class T1, class T2>istream& operator >> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }
//istream& operator >> (istream& is, modint1000000007& x) { unsigned int t; is >> t; x=t; return is; }
//istream& operator >> (istream& is, modint998244353& x) { unsigned int t; is >> t; x=t; return is; }
ostream& operator << (ostream& os, const modint1000000007& x) { os << x.val(); return os; }
ostream& operator << (ostream& os, const modint998244353& x) { os << x.val(); return os; }
template<class... A> void pt() { std::cout << "\n"; }
template<class... A> void pt_rest() { std::cout << "\n"; }
template<class T, class... A> void pt_rest(const T& first, const A&... rest) { std::cout << " " << first; pt_rest(rest...); }
template<class T, class... A> void pt(const T& first, const A&... rest) { std::cout << first; pt_rest(rest...); }
static const ll INF=1e18+7;
static const ll MAX=101010;
static const ll MOD=1e9+7;
static const double PI=acos(-1);
static const double EPS=1e-10;
//static const ll MOD=998244353;
using v1d=vector<modint1000000007>;
using v2d=vector<v1d>;
using v3d=vector<v2d>;
using v4d=vector<v3d>;
struct S{
modint1000000007 val;
ll size;
S(modint1000000007 val,ll size):val(val),size(size){}
};
using F=modint1000000007;
S op(S a,S b){
return {a.val+b.val,a.size+b.size};
}
S e(){
return {0,0};
}
S mapping(F f,S x){
return {x.val+f*x.size,x.size};
}
F composition(F f,F g){
return f+g;
}
F id(){
return 0;
}
int main(void) {
cin.tie(nullptr);
ios::sync_with_stdio(false);
ll i,j,k;
ll N,M,K;cin>>N>>M>>K;
vector<ll> l(M),r(M);
for(i=0;i<M;i++)cin>>l[i]>>r[i];
vector<lazy_segtree<S,op,e,F,mapping,composition,id>>seg(2,lazy_segtree<S,op,e,F,mapping,composition,id>(vector<S>(N+1,{0,1})));
seg[0].set(1,{1,1});
ll tur=0;
for(k=0;k<K;k++){
seg[1-tur]=lazy_segtree<S,op,e,F,mapping,composition,id>(vector<S>(N+1,{0,1}));
for(i=0;i<M;i++){
modint1000000007 t=seg[tur].prod(l[i],r[i]+1).val;
seg[1-tur].apply(l[i],r[i]+1,t);
}
tur=1-tur;
}
pt(seg[K&1].get(N).val);
}