正文
增加 74 行删除 74 行
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182837 行未改动91929394959697989944 行未改动144145146147148149## 题面[超级区间](https://www.luogu.me/article/x3zuuo4q)## 题解```cpp/** File: game.cpp* Author: Zi_Gao* My Website: www.zigao.ac*/#include<bits/stdc++.h>// #define ONLINE_JUDGE#define INPUT_DATA_TYPE int#define OUTPUT_DATA_TYPE intINPUT_DATA_TYPE read(){register INPUT_DATA_TYPE x=0;register charf=0,c=getchar();while(c<'0'||'9'<c)f=(c=='-'),c=getchar();while('0'<=c&&c<='9')x=(x<<3)+(x<<1)+(c&15),c=getchar();return f?-x:x;}void print(OUTPUT_DATA_TYPE x){if(x<0)x=-x,putchar('-');if(x>9)print(x/10);putchar(x%10^48);return;}intLimId[1000010],Lsiz[1000010],Rsiz[1000010],nowL[1000010],nowR[1000010],minL[1000010],maxR[1000010];std::bitset<1000010> isOk;std::vector<int> buc[100010];struct DEL_HEAP{std::priority_queue<int> all,del;void insert(int x){all.push(x);}void erase(int x){del.push(x);}int top(){while(!del.empty()&&all.top()==del.top()) all.pop(),del.pop();return all.top();}void pop(){while(!del.empty()&&all.top()==del.top()) all.pop(),del.pop();all.pop();}int size(){return all.size()-del.size();}};DEL_HEAP Lrgs,Rrgs;int main(){#ifndef ONLINE_JUDGEfreopen("range.in", "r", stdin);freopen("range.out", "w", stdout);#endifregister int i,j,x,nowOk=0,id,l,r;int n=read();int m=read();int q=read();for(i=1,j=0;i<m;++i){x=read();while(j<x) LimId[j++]=i;}while(j<=1000000) LimId[j++]=i;for(i=1;i<=m;++i){Lsiz[i]=read(),Rsiz[i]=read();}for(i=1;i<=m;++i){buc[i].clear();buc[i].push_back(0);if(Lsiz[i]==0) isOk[i]=1,++nowOk,Lrgs.insert(nowL[i]=0),Rrgs.insert((nowR[i]=n+1));else isOk[i]=0;}for(i=1;i<=n;++i){id=LimId[x=read()];buc[id].push_back(i);if(buc[id].size()-1>=Lsiz[id]){if(isOk[id]) Lrgs.erase(nowL[id]),Rrgs.erase(-nowR[id]);else isOk[id]=1,++nowOk;Lrgs.insert(nowL[id]=buc[id][std::max(0,(int)buc[id].size()Rsiz[id]-1)]+1);if(Lsiz[id]==0) Rrgs.insert(-(nowR[id]=n+1));else Rrgs.insert(-(nowR[id]=buc[id][buc[id].size()-Lsiz[id]]));}if(nowOk==m&&-Rrgs.top()>=Lrgs.top()) minL[i]=Lrgs.top(),maxR[i]=-Rrgs.top();else minL[i]=i+1;}while(q--){l=read();r=read();if(minL[r]<=l&&l<=maxR[r]) puts("YES");else puts("NO");}#ifndef ONLINE_JUDGEfclose(stdin);fclose(stdout);#endifreturn 0;}```### man级码风## 我的7 行未改动int l;int r;bool hav;}ra[1000005];int n,m,q,p[1005],lo[1005],hi[1005],a[1000005],u,v,k,now[1005],cnt;signed main(){scanf("%lld%lld%lld",&n,&m,&q);p[0]=0;for(int i=1;i<m;i++)scanf("%lld",&p[i]);44 行未改动else if(ra[u].l<=v&&v<=ra[u].r)cout<<"YES\n";else cout<<"NO\n";}return 0;}```12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182837 行未改动91929394959697989944 行未改动144145146147148149## 题面[超级区间](https://www.luogu.me/article/x3zuuo4q)## 题解```cpp/** File: game.cpp* Author: Zi_Gao* My Website: www.zigao.ac*/#include<bits/stdc++.h>// #define ONLINE_JUDGE#define INPUT_DATA_TYPE int#define OUTPUT_DATA_TYPE intINPUT_DATA_TYPE read(){register INPUT_DATA_TYPE x=0;register charf=0,c=getchar();while(c<'0'||'9'<c)f=(c=='-'),c=getchar();while('0'<=c&&c<='9')x=(x<<3)+(x<<1)+(c&15),c=getchar();return f?-x:x;}void print(OUTPUT_DATA_TYPE x){if(x<0)x=-x,putchar('-');if(x>9)print(x/10);putchar(x%10^48);return;}intLimId[1000010],Lsiz[1000010],Rsiz[1000010],nowL[1000010],nowR[1000010],minL[1000010],maxR[1000010];std::bitset<1000010> isOk;std::vector<int> buc[100010];struct DEL_HEAP{std::priority_queue<int> all,del;void insert(int x){all.push(x);}void erase(int x){del.push(x);}int top(){while(!del.empty()&&all.top()==del.top()) all.pop(),del.pop();return all.top();}void pop(){while(!del.empty()&&all.top()==del.top()) all.pop(),del.pop();all.pop();}int size(){return all.size()-del.size();}};DEL_HEAP Lrgs,Rrgs;int main(){#ifndef ONLINE_JUDGEfreopen("range.in", "r", stdin);freopen("range.out", "w", stdout);#endifregister int i,j,x,nowOk=0,id,l,r;int n=read();int m=read();int q=read();for(i=1,j=0;i<m;++i){x=read();while(j<x) LimId[j++]=i;}while(j<=1000000) LimId[j++]=i;for(i=1;i<=m;++i){Lsiz[i]=read(),Rsiz[i]=read();}for(i=1;i<=m;++i){buc[i].clear();buc[i].push_back(0);if(Lsiz[i]==0) isOk[i]=1,++nowOk,Lrgs.insert(nowL[i]=0),Rrgs.insert((nowR[i]=n+1));else isOk[i]=0;}for(i=1;i<=n;++i){id=LimId[x=read()];buc[id].push_back(i);if(buc[id].size()-1>=Lsiz[id]){if(isOk[id]) Lrgs.erase(nowL[id]),Rrgs.erase(-nowR[id]);else isOk[id]=1,++nowOk;Lrgs.insert(nowL[id]=buc[id][std::max(0,(int)buc[id].size()Rsiz[id]-1)]+1);if(Lsiz[id]==0) Rrgs.insert(-(nowR[id]=n+1));else Rrgs.insert(-(nowR[id]=buc[id][buc[id].size()-Lsiz[id]]));}if(nowOk==m&&-Rrgs.top()>=Lrgs.top()) minL[i]=Lrgs.top(),maxR[i]=-Rrgs.top();else minL[i]=i+1;}while(q--){l=read();r=read();if(minL[r]<=l&&l<=maxR[r]) puts("YES");else puts("NO");}#ifndef ONLINE_JUDGEfclose(stdin);fclose(stdout);#endifreturn 0;}```### man级码风## 我的7 行未改动int l;int r;bool hav;}ra[1000005];int n,m,q,p[1005],lo[1005],hi[1005],a[1000005],u,v,k,now[1005],cnt;signed main(){scanf("%lld%lld%lld",&n,&m,&q);p[0]=0;for(int i=1;i<m;i++)scanf("%lld",&p[i]);44 行未改动else if(ra[u].l<=v&&v<=ra[u].r)cout<<"YES\n";else cout<<"NO\n";}return 0;}```