F.A.Q
Hand In Hand
Online Acmers
Problem Archive
Realtime Judge Status
Authors Ranklist
 
     C/C++/Java Exams     
ACM Steps
Go to Job
Contest LiveCast
ICPC@China
Best Coder beta
VIP | STD Contests
    DIY | Web-DIY beta
Author ID 
Password 
 Register new ID

View Compilation Error

0_0_33440785_21420.cpp:3:12: error: "+" may not appear in macro parameter list
 #define m(l+r)/2
            ^
0_0_33440785_21420.cpp: In function 'void update(int, int, int&, int, int)':
0_0_33440785_21420.cpp:4:240: error: 'm' was not declared in this scope
 struct hjt{int l,r,sum;}tree[24*N];vector<int>g;int get_id(int x){return lower_bound(g.begin(),g.end(),x)-g.begin()+1;}void update(int pos,int last,int&now,int l,int r){now=top++;tree[now]=tree[last];tree[now].sum++;if(l==r)return;if(pos<=m)update(pos,tree[last].l,tree[now].l,l,m);else update(pos,tree[last].r,tree[now].r,m+1,r);}int query(int v,int last,int now,int l,int r){if(l==r){return tree[now].sum-tree[last].sum;}int ans=0;int sum=tree[tree[now].l].sum-tree[tree[last].l].sum;if(v<=m){ans+=query(v,tree[last].l,tree[now].l,l,m);}else{ans+=sum;ans+=query(v,tree[last].sum,tree[now].r,m+1,r);}return ans;}int main(){scanf("%d",&t);while(t--){top=1;g.clear();scanf("%d %d",&n,&q);for(int i=1;i<=n;i++){scanf("%d",&a[i]);g.push_back(a[i]);}sort(g.begin(),g.end());g.erase(unique(g.begin(),g.end()),g.end());for(int i=1;i<=n;i++){nt pos=get_id(a[i]);update(pos,rt[i-1],rt[i],1,(int)g.size());}while(q--){int ql,qr,p,k;scanf("%d %d %d %d",&ql,&qr,&p,&k);int l=0,r=1000000,ans;int last=0;ql=last^ql;qr=last^qr;while(l<=r){int down=p-m;int up=p+m;down=get_id(down);up=get_id(up);if(up-1>g.size())up--;int cntl=query(down,rt[ql-1],rt[qr],1,(int)g.size());int cntr=query(up,rt[ql-1],rt[qr],1,(int)g.size());int cnt=cntr-cntl+1;if(cnt>=k){ans=m;r=m-1;}else{l=m+1;}}printf("%d\n",ans);last=ans;}for(int i=0;i<=top;i++){tree[i].l=tree[i].r=tree[i].sum=0;}for(int i=0;i<=n;i++){rt[i]=0;}}}
                                                                                                                                                                                                                                                ^
0_0_33440785_21420.cpp: In function 'int query(int, int, int, int, int)':
0_0_33440785_21420.cpp:4:493: error: 'm' was not declared in this scope
 struct hjt{int l,r,sum;}tree[24*N];vector<int>g;int get_id(int x){return lower_bound(g.begin(),g.end(),x)-g.begin()+1;}void update(int pos,int last,int&now,int l,int r){now=top++;tree[now]=tree[last];tree[now].sum++;if(l==r)return;if(pos<=m)update(pos,tree[last].l,tree[now].l,l,m);else update(pos,tree[last].r,tree[now].r,m+1,r);}int query(int v,int last,int now,int l,int r){if(l==r){return tree[now].sum-tree[last].sum;}int ans=0;int sum=tree[tree[now].l].sum-tree[tree[last].l].sum;if(v<=m){ans+=query(v,tree[last].l,tree[now].l,l,m);}else{ans+=sum;ans+=query(v,tree[last].sum,tree[now].r,m+1,r);}return ans;}int main(){scanf("%d",&t);while(t--){top=1;g.clear();scanf("%d %d",&n,&q);for(int i=1;i<=n;i++){scanf("%d",&a[i]);g.push_back(a[i]);}sort(g.begin(),g.end());g.erase(unique(g.begin(),g.end()),g.end());for(int i=1;i<=n;i++){nt pos=get_id(a[i]);update(pos,rt[i-1],rt[i],1,(int)g.size());}while(q--){int ql,qr,p,k;scanf("%d %d %d %d",&ql,&qr,&p,&k);int l=0,r=1000000,ans;int last=0;ql=last^ql;qr=last^qr;while(l<=r){int down=p-m;int up=p+m;down=get_id(down);up=get_id(up);if(up-1>g.size())up--;int cntl=query(down,rt[ql-1],rt[qr],1,(int)g.size());int cntr=query(up,rt[ql-1],rt[qr],1,(int)g.size());int cnt=cntr-cntl+1;if(cnt>=k){ans=m;r=m-1;}else{l=m+1;}}printf("%d\n",ans);last=ans;}for(int i=0;i<=top;i++){tree[i].l=tree[i].r=tree[i].sum=0;}for(int i=0;i<=n;i++){rt[i]=0;}}}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             ^
0_0_33440785_21420.cpp: In function 'int main()':
0_0_33440785_21420.cpp:4:836: error: 'nt' was not declared in this scope
 struct hjt{int l,r,sum;}tree[24*N];vector<int>g;int get_id(int x){return lower_bound(g.begin(),g.end(),x)-g.begin()+1;}void update(int pos,int last,int&now,int l,int r){now=top++;tree[now]=tree[last];tree[now].sum++;if(l==r)return;if(pos<=m)update(pos,tree[last].l,tree[now].l,l,m);else update(pos,tree[last].r,tree[now].r,m+1,r);}int query(int v,int last,int now,int l,int r){if(l==r){return tree[now].sum-tree[last].sum;}int ans=0;int sum=tree[tree[now].l].sum-tree[tree[last].l].sum;if(v<=m){ans+=query(v,tree[last].l,tree[now].l,l,m);}else{ans+=sum;ans+=query(v,tree[last].sum,tree[now].r,m+1,r);}return ans;}int main(){scanf("%d",&t);while(t--){top=1;g.clear();scanf("%d %d",&n,&q);for(int i=1;i<=n;i++){scanf("%d",&a[i]);g.push_back(a[i]);}sort(g.begin(),g.end());g.erase(unique(g.begin(),g.end()),g.end());for(int i=1;i<=n;i++){nt pos=get_id(a[i]);update(pos,rt[i-1],rt[i],1,(int)g.size());}while(q--){int ql,qr,p,k;scanf("%d %d %d %d",&ql,&qr,&p,&k);int l=0,r=1000000,ans;int last=0;ql=last^ql;qr=last^qr;while(l<=r){int down=p-m;int up=p+m;down=get_id(down);up=get_id(up);if(up-1>g.size())up--;int cntl=query(down,rt[ql-1],rt[qr],1,(int)g.size());int cntr=query(up,rt[ql-1],rt[qr],1,(int)g.size());int cnt=cntr-cntl+1;if(cnt>=k){ans=m;r=m-1;}else{l=m+1;}}printf("%d\n",ans);last=ans;}for(int i=0;i<=top;i++){tree[i].l=tree[i].r=tree[i].sum=0;}for(int i=0;i<=n;i++){rt[i]=0;}}}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    ^
0_0_33440785_21420.cpp:4:863: error: 'pos' was not declared in this scope
 struct hjt{int l,r,sum;}tree[24*N];vector<int>g;int get_id(int x){return lower_bound(g.begin(),g.end(),x)-g.begin()+1;}void update(int pos,int last,int&now,int l,int r){now=top++;tree[now]=tree[last];tree[now].sum++;if(l==r)return;if(pos<=m)update(pos,tree[last].l,tree[now].l,l,m);else update(pos,tree[last].r,tree[now].r,m+1,r);}int query(int v,int last,int now,int l,int r){if(l==r){return tree[now].sum-tree[last].sum;}int ans=0;int sum=tree[tree[now].l].sum-tree[tree[last].l].sum;if(v<=m){ans+=query(v,tree[last].l,tree[now].l,l,m);}else{ans+=sum;ans+=query(v,tree[last].sum,tree[now].r,m+1,r);}return ans;}int main(){scanf("%d",&t);while(t--){top=1;g.clear();scanf("%d %d",&n,&q);for(int i=1;i<=n;i++){scanf("%d",&a[i]);g.push_back(a[i]);}sort(g.begin(),g.end());g.erase(unique(g.begin(),g.end()),g.end());for(int i=1;i<=n;i++){nt pos=get_id(a[i]);update(pos,rt[i-1],rt[i],1,(int)g.size());}while(q--){int ql,qr,p,k;scanf("%d %d %d %d",&ql,&qr,&p,&k);int l=0,r=1000000,ans;int last=0;ql=last^ql;qr=last^qr;while(l<=r){int down=p-m;int up=p+m;down=get_id(down);up=get_id(up);if(up-1>g.size())up--;int cntl=query(down,rt[ql-1],rt[qr],1,(int)g.size());int cntr=query(up,rt[ql-1],rt[qr],1,(int)g.size());int cnt=cntr-cntl+1;if(cnt>=k){ans=m;r=m-1;}else{l=m+1;}}printf("%d\n",ans);last=ans;}for(int i=0;i<=top;i++){tree[i].l=tree[i].r=tree[i].sum=0;}for(int i=0;i<=n;i++){rt[i]=0;}}}
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               ^
0_0_33440785_21420.cpp:4:1037: error: 'm' was not declared in this scope
 struct hjt{int l,r,sum;}tree[24*N];vector<int>g;int get_id(int x){return lower_bound(g.begin(),g.end(),x)-g.begin()+1;}void update(int pos,int last,int&now,int l,int r){now=top++;tree[now]=tree[last];tree[now].sum++;if(l==r)return;if(pos<=m)update(pos,tree[last].l,tree[now].l,l,m);else update(pos,tree[last].r,tree[now].r,m+1,r);}int query(int v,int last,int now,int l,int r){if(l==r){return tree[now].sum-tree[last].sum;}int ans=0;int sum=tree[tree[now].l].sum-tree[tree[last].l].sum;if(v<=m){ans+=query(v,tree[last].l,tree[now].l,l,m);}else{ans+=sum;ans+=query(v,tree[last].sum,tree[now].r,m+1,r);}return ans;}int main(){scanf("%d",&t);while(t--){top=1;g.clear();scanf("%d %d",&n,&q);for(int i=1;i<=n;i++){scanf("%d",&a[i]);g.push_back(a[i]);}sort(g.begin(),g.end());g.erase(unique(g.begin(),g.end()),g.end());for(int i=1;i<=n;i++){nt pos=get_id(a[i]);update(pos,rt[i-1],rt[i],1,(int)g.size());}while(q--){int ql,qr,p,k;scanf("%d %d %d %d",&ql,&qr,&p,&k);int l=0,r=1000000,ans;int last=0;ql=last^ql;qr=last^qr;while(l<=r){int down=p-m;int up=p+m;down=get_id(down);up=get_id(up);if(up-1>g.size())up--;int cntl=query(down,rt[ql-1],rt[qr],1,(int)g.size());int cntr=query(up,rt[ql-1],rt[qr],1,(int)g.size());int cnt=cntr-cntl+1;if(cnt>=k){ans=m;r=m-1;}else{l=m+1;}}printf("%d\n",ans);last=ans;}for(int i=0;i<=top;i++){tree[i].l=tree[i].r=tree[i].sum=0;}for(int i=0;i<=n;i++){rt[i]=0;}}}
                                                                                                 


Hangzhou Dianzi University Online Judge 3.0
Copyright © 2005-2024 HDU ACM Team. All Rights Reserved.
Designer & Developer : Wang Rongtao LinLe GaoJie GanLu
Total 0.000000(s) query 1, Server time : 2024-11-22 01:50:21, Gzip enabled