Language: C++

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

struct LazySegTree{
    int n; vector<int> dat,lazy;
    //初期化
    LazySegTree(int _n){
        n=1;
        while(n<_n) n*=2;
        dat=vector<int>(2*n-1,0);
        lazy=vector<int>(2*n-1,0);
    }

    void setLazy(int k, int v){
        lazy[k] = v;
        dat[k] = v;
    }

    void push(int k, int l, int r){
        if(lazy[k]!=0){
            setLazy(2*k+1,lazy[k]);
            setLazy(2*k+2,lazy[k]);
        }
        lazy[k]=0;
    }

    void fix(int k, int l, int r){
        dat[k] = dat[2*k+1]&dat[2*k+2];
    }

    int merge(int x, int y){
        return x&y;
    }

    //内部的に投げられるクエリ
    void _update(int a, int b, int x, int k, int l, int r){
        if(r<=a || b<=l) return;
        if(a<=l && r<=b){
            setLazy(k,x);
            return;
        }

        push(k,l,r);
        _update(a,b,x,2*k+1,l,(l+r)/2);
        _update(a,b,x,2*k+2,(l+r)/2,r);

        fix(k,l,r);
    }
    //[a,b)をxに更新
    void update(int a, int b, int x){
        return _update(a,b,x,0,0,n);
    }

    //内部的に投げられるクエリ
    int _query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return 1;
        if(a<=l && r<=b) return dat[k];

        push(k,l,r);
        int vl=_query(a,b,2*k+1,l,(l+r)/2);
        int vr=_query(a,b,2*k+2,(l+r)/2,r);
        return merge(vl,vr);
    }
    //[a,b)
    int query(int a, int b){
        return _query(a,b,0,0,n);
    }
};

const int N = 200000;
vector<int> C[N],Q[N];

int main(){
    int n,m,q;
    scanf(" %d %d %d", &n, &m, &q);

    vector<int> d(m),a(m),b(m);
    rep(i,m) scanf(" %d %d %d", &d[i], &a[i], &b[i]);

    vector<int> e(q),s(q),t(q);
    rep(i,q) scanf(" %d %d %d", &e[i], &s[i], &t[i]);

    vector<int> v;
    rep(i,m) v.pb(d[i]);
    rep(i,q) v.pb(e[i]);
    sort(all(v));
    v.erase(unique(all(v)), v.end());
    int V = v.size();

    rep(i,m){
        int idx = lower_bound(all(v), d[i])-v.begin();
        C[idx].pb(i);
    }
    rep(i,q){
        int idx = lower_bound(all(v), e[i])-v.begin();
        Q[idx].pb(i);
    }

    LazySegTree st(n);
    vector<bool> ans(q);
    rep(i,V){
        for(int &ID:Q[i]) ans[ID] = st.query(s[ID], t[ID]);
        for(int &ID:C[i]) st.update(a[ID], b[ID], 1);
    }
    rep(i,q) printf("%s\n", (ans[i]?"Yes":"No"));
    return 0;
}
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i,n) for(int (i)=0;(i)<(int)(n);++(i))
#define all(x) (x).begin(),(x).end()
#define pb push_back
#define fi first
#define se second
#define dbg(x) cout<<#x" = "<<((x))<<endl
template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}

struct LazySegTree{
    int n; vector<int> dat,lazy;
    //初期化
    LazySegTree(int _n){
        n=1;
        while(n<_n) n*=2;
        dat=vector<int>(2*n-1,0);
        lazy=vector<int>(2*n-1,0);
    }

    void setLazy(int k, int v){
        lazy[k] = v;
        dat[k] = v;
    }

    void push(int k, int l, int r){
        if(lazy[k]!=0){
            setLazy(2*k+1,lazy[k]);
            setLazy(2*k+2,lazy[k]);
        }
        lazy[k]=0;
    }

    void fix(int k, int l, int r){
        dat[k] = dat[2*k+1]&dat[2*k+2];
    }

    int merge(int x, int y){
        return x&y;
    }

    //内部的に投げられるクエリ
    void _update(int a, int b, int x, int k, int l, int r){
        if(r<=a || b<=l) return;
        if(a<=l && r<=b){
            setLazy(k,x);
            return;
        }

        push(k,l,r);
        _update(a,b,x,2*k+1,l,(l+r)/2);
        _update(a,b,x,2*k+2,(l+r)/2,r);

        fix(k,l,r);
    }
    //[a,b)をxに更新
    void update(int a, int b, int x){
        return _update(a,b,x,0,0,n);
    }

    //内部的に投げられるクエリ
    int _query(int a, int b, int k, int l, int r){
        if(r<=a || b<=l) return 1;
        if(a<=l && r<=b) return dat[k];

        push(k,l,r);
        int vl=_query(a,b,2*k+1,l,(l+r)/2);
        int vr=_query(a,b,2*k+2,(l+r)/2,r);
        return merge(vl,vr);
    }
    //[a,b)
    int query(int a, int b){
        return _query(a,b,0,0,n);
    }
};

const int N = 200000;
vector<int> C[N],Q[N];

int main(){
    int n,m,q;
    scanf(" %d %d %d", &n, &m, &q);

    vector<int> d(m),a(m),b(m);
    rep(i,m) scanf(" %d %d %d", &d[i], &a[i], &b[i]);

    vector<int> e(q),s(q),t(q);
    rep(i,q) scanf(" %d %d %d", &e[i], &s[i], &t[i]);

    vector<int> v;
    rep(i,m) v.pb(d[i]);
    rep(i,q) v.pb(e[i]);
    sort(all(v));
    v.erase(unique(all(v)), v.end());
    int V = v.size();

    rep(i,m){
        int idx = lower_bound(all(v), d[i])-v.begin();
        C[idx].pb(i);
    }
    rep(i,q){
        int idx = lower_bound(all(v), e[i])-v.begin();
        Q[idx].pb(i);
    }

    LazySegTree st(n);
    vector<bool> ans(q);
    rep(i,V){
        for(int &ID:Q[i]) ans[ID] = st.query(s[ID], t[ID]);
        for(int &ID:C[i]) st.update(a[ID], b[ID], 1);
    }
    rep(i,q) printf("%s\n", (ans[i]?"Yes":"No"));
    return 0;
}



Compiler output:
a.cc:126:36: error: redefinition of 'template<class T, class U> std::ostream& operator<<(std::ostream&, const std::pair<_T1, _T2>&)'
  126 | template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
      |                                    ^~~~~~~~
a.cc:10:36: note: 'template<class T, class U> std::ostream& operator<<(std::ostream&, const std::pair<_T1, _T2>&)' previously declared here
   10 | template<class T,class U> ostream& operator<<(ostream& o, const pair<T,U> &p){o<<"("<<p.fi<<","<<p.se<<")";return o;}
      |                                    ^~~~~~~~
a.cc:127:28: error: redefinition of 'template<class T> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)'
  127 | template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
      |                            ^~~~~~~~
a.cc:11:28: note: 'template<class T> std::ostream& operator<<(std::ostream&, const std::vector<_Tp>&)' previously declared here
   11 | template<class T> ostream& operator<<(ostream& o, const vector<T> &v){o<<"[";for(T t:v){o<<t<<",";}o<<"]";return o;}
      |                            ^~~~~~~~
a.cc:129:8: error: redefinition of 'struct LazySegTree'
  129 | struct LazySegTree{
      |        ^~~~~~~~~~~
a.cc:13:8: note: previous definition of 'struct LazySegTree'
   13 | struct LazySegTree{
      |        ^~~~~~~~~~~
a.cc:195:11: error: redefinition of 'const int N'
  195 | const int N = 200000;
      |           ^
a.cc:79:11: note: 'const int N' previously defined here
   79 | const int N = 200000;
      |           ^
a.cc:196:13: error: redefinition of 'std::vector<int> C [200000]'
  196 | vector<int> C[N],Q[N];
      |             ^
a.cc:80:13: note: 'std::vector<int> C [200000]' previously declared here
   80 | vector<int> C[N],Q[N];
      |             ^
a.cc:196:18: error: redefinition of 'std::vector<int> Q [200000]'
  196 | vector<int> C[N],Q[N];
      |                  ^
a.cc:80:18: note: 'std::vector<int> Q [200000]' previously declared here
   80 | vector<int> C[N],Q[N];
      |                  ^
a.cc:198:5: error: redefinition of 'int main()'
  198 | int main(){
      |     ^~~~
a.cc:82:5: note: 'int main()' previously defined here
   82 | int main(){
      |     ^~~~