結果

問題 No.801 エレベーター
ユーザー eQeeQe
提出日時 2021-10-08 10:29:49
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,363 bytes
コンパイル時間 4,072 ms
コンパイル使用メモリ 239,356 KB
実行使用メモリ 8,704 KB
最終ジャッジ日時 2023-09-30 09:15:42
合計ジャッジ時間 8,655 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 57 ms
8,436 KB
testcase_04 AC 57 ms
8,360 KB
testcase_05 AC 57 ms
8,428 KB
testcase_06 AC 57 ms
8,376 KB
testcase_07 AC 60 ms
8,608 KB
testcase_08 AC 59 ms
8,552 KB
testcase_09 AC 57 ms
8,360 KB
testcase_10 AC 58 ms
8,704 KB
testcase_11 AC 57 ms
8,344 KB
testcase_12 AC 58 ms
8,576 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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... 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...); }

template<class T1, class T2>istream& operator >> (istream& is, pair<T1,T2>& p) { is >> p.first >> p.second; return is; }

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(K+1,lazy_segtree<S,op,e,F,mapping,composition,id>(vector<S>(N+1,{0,1})));
  seg[0].set(1,{1,1});
  for(k=0;k<K;k++){
    for(i=0;i<M;i++){
      modint1000000007 t=seg[k].prod(l[i],r[i]+1).val;
      seg[k+1].apply(l[i],r[i]+1,t);
    }
  }
  
  pt(seg[K].get(N).val.val());
  
}
0