#include #include using namespace std; using ll=long long; int seg_op(int a,int b){ return 0; } int seg_e(){ return -1; } int seg_comp(int f1,int f2){ return max(f1,f2); } int seg_id(){ return -1; } int seg_map(int f,int s){ return max(f,s); } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int N,A; cin>>N>>A; vector X(N,0); for(int &i:X)cin>>i; auto X2=X; sort(X2.begin(),X2.end()); X2.erase(unique(X2.begin(),X2.end()),X2.end()); atcoder::lazy_segtree seg(X2.size()); int Q; cin>>Q; for(int t=1;t<=Q;t++){ int L,R; cin>>L>>R; R+=1; L=lower_bound(X2.begin(),X2.end(),L)-X2.begin(); R=lower_bound(X2.begin(),X2.end(),R)-X2.begin(); seg.apply(L,R,t); } for(int i=0;i