QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#413180#8672. 排队ANIG#Compile Error//C++141.8kb2024-05-17 09:17:502024-05-17 09:17:51

Judging History

你现在查看的是最新测评结果

  • [2024-05-17 09:17:51]
  • 评测
  • [2024-05-17 09:17:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long
const int N=1e6+5;
int n,m,l[N],r[N],rs[N],f[N];
struct node{
	int l,r,laz,mx,mn;
}p[N<<2];
void upset(int x){
	p[x].mx=max(p[x<<1].mx,p[x<<1|1].mx);
	p[x].mn=min(p[x<<1].mn,p[x<<1|1].mn);
}
void add(int x,int sm){
	p[x].laz+=sm;
	p[x].mx+=sm;
	p[x].mn+=sm;
}
void dnset(int x){
	if(p[x].laz){
		add(x<<1,p[x].laz);
		add(x<<1|1,p[x].laz);
		p[x].laz=0;
	}
}
void add(int x,int l,int r,int sm){
	if(l<=p[x].l&&r>=p[x].r){
		add(x,sm);
		return;
	}
	dnset(x);
	int mid=p[x].l+p[x].r>>1;
	if(l<=mid)add(x<<1,l,r,sm);
	if(r>mid)add(x<<1|1,l,r,sm);
	upset(x);
}
int gets(int x,int d){
	if(p[x].l==p[x].r)return p[x].laz;
	dnset(x);
	if(d<=(p[x].l+p[x].r>>1))return gets(x<<1,d);
	return gets(x<<1|1,d);
}
int gets1(int x,int k,int d){
	if(p[x].l==p[x].r)return p[x].l;
	dnset(x);
	if(d<=(p[x].l+p[x].r>>1))return gets1(x<<1,k,d);
	if(p[x<<1|1].mx>=k)return gets1(x<<1|1,k,d);
	return gets1(x<<1,k,d);
}
int gets2(int x,int k){
	if(p[x].l==p[x].r)return p[x].l;
	dnset(x);
	if(p[x<<1].mn<=k)return gets2(x<<1,k);
	return gets2(x<<1|1,k);
}
void reset(int x,int l,int r){
	p[x].l=l,p[x].r=r;
	if(l==r)return;
	int mid=l+r>>1;
	reset(x<<1,l,mid);
	reset(x<<1|1,mid+1,r);
}
vector<pair<int,int> >g[N];
signed main(){
	cin>>n>>m;
	reset(1,1,n);
	for(int i=1;i<=n;i++)cin>>l[i]>>r[i];
	for(int i=1;i<=m;i++){
		int l,r;
		cin>>l>>r;
		g[r].push_back({l,i});
	}
	for(int i=1;i<=n;i++){
		int a=gets2(1,r[i]),b=gets1(1,l[i],i);
		for(int j=1;j<=n;j++)if(gets(1,c.first)<=r[i]){
			a=j;
			break;
		}
	//	cout<<a<<"-"<<b<<endl;
		if(a<=b)add(1,a,b,1);
		for(auto c:g[i]){
			rs[c.second]=gets(1,c.first);
		}
	}
	for(int i=1;i<=m;i++)cout<<rs[i]<<"\n";
}

詳細信息

answer.code: In function ‘int main()’:
answer.code:74:48: error: ‘c’ was not declared in this scope
   74 |                 for(int j=1;j<=n;j++)if(gets(1,c.first)<=r[i]){
      |                                                ^