結果

問題 No.801 エレベーター
ユーザー eQeeQe
提出日時 2021-10-08 10:52:57
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,759 bytes
コンパイル時間 4,285 ms
コンパイル使用メモリ 240,076 KB
実行使用メモリ 7,988 KB
最終ジャッジ日時 2023-09-30 09:15:57
合計ジャッジ時間 8,870 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 48 ms
4,380 KB
testcase_04 AC 46 ms
4,376 KB
testcase_05 AC 46 ms
4,380 KB
testcase_06 AC 49 ms
4,380 KB
testcase_07 AC 50 ms
4,376 KB
testcase_08 AC 51 ms
4,380 KB
testcase_09 AC 49 ms
4,376 KB
testcase_10 AC 48 ms
4,376 KB
testcase_11 AC 48 ms
4,376 KB
testcase_12 AC 47 ms
4,376 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 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];
  
  lazy_segtree<S,op,e,F,mapping,composition,id>seg(vector<S>(N+1,{0,1}));
  seg.set(1,{1,1});
  for(k=0;k<K;k++){
    lazy_segtree<S,op,e,F,mapping,composition,id>tmp(vector<S>(N+1,{0,1}));
    for(i=0;i<M;i++){
      modint1000000007 t=seg.prod(l[i],r[i]+1).val;
      tmp.apply(l[i],r[i]+1,t);
    }
    seg=tmp;
  }
  
  pt(seg.get(N).val);
  
}
0