Compile Error
/in/foo.cc: In function 'const void push_col(long long int, long long int, long long int)': /in/foo.cc:47:39: error: expected primary-expression before '/' token height[p<<1]=height[p]+max(lh[p<<1]*/+,rh[p<<1]*/+); ^ /in/foo.cc:47:41: error: expected primary-expression before ',' token height[p<<1]=height[p]+max(lh[p<<1]*/+,rh[p<<1]*/+); ^ /in/foo.cc:47:51: error: expected primary-expression before '/' token height[p<<1]=height[p]+max(lh[p<<1]*/+,rh[p<<1]*/+); ^ /in/foo.cc:47:53: error: expected primary-expression before ')' token height[p<<1]=height[p]+max(lh[p<<1]*/+,rh[p<<1]*/+); ^ /in/foo.cc:48:41: error: expected primary-expression before '/' token height[p<<1|1]=height[p]+max(lh[p<<1]*/+,rh[p<<1|1]*/+); ^ /in/foo.cc:48:43: error: expected primary-expression before ',' token height[p<<1|1]=height[p]+max(lh[p<<1]*/+,rh[p<<1|1]*/+); ^ /in/foo.cc:48:55: error: expected primary-expression before '/' token height[p<<1|1]=height[p]+max(lh[p<<1]*/+,rh[p<<1|1]*/+); ^ /in/foo.cc:48:57: error: expected primary-expression before ')' token height[p<<1|1]=height[p]+max(lh[p<<1]*/+,rh[p<<1|1]*/+); ^ /in/foo.cc: In function 'const long long int query(long long int, long long int, long long int, long long int, long long int)': /in/foo.cc:55:12: error: too few arguments to function 'const void push_col(long long int, long long int, long long int)' push_col(p); ^ /in/foo.cc:39:19: note: declared here inline const void push_col(LL p,LL l,LL r) ^~~~~~~~ /in/foo.cc:57:44: error: too few arguments to function 'const long long int max(long long int, long long int)' if(mid>=ll)ans=max(query(p<<1,l,mid,ll,rr)); ^ /in/foo.cc:20:17: note: declared here inline const LL max(LL a,LL b) ^~~ /in/foo.cc:58:50: error: too few arguments to function 'const long long int max(long long int, long long int)' if(mid+1<=rr)ans=max(query(p<<1|1,mid+1,r,ll,rr)); ^ /in/foo.cc:20:17: note: declared here inline const LL max(LL a,LL b) ^~~ /in/foo.cc: In function 'int main()': /in/foo.cc:105:18: error: expected primary-expression before ',' token modify(1,1,n,,,y,0); ^ /in/foo.cc:105:19: error: expected primary-expression before ',' token modify(1,1,n,,,y,0); ^ /in/foo.cc:106:18: error: expected primary-expression before ',' token modify(1,1,n,,,y,y); ^ /in/foo.cc:106:19: error: expected primary-expression before ',' token modify(1,1,n,,,y,y); ^
代码
#include<bits/stdc++.h>
#define LL long long
const long long maxn=1e5;
inline const void read(LL &a)
{
a=0;
char c=getchar();
while(c<'0'||c>'9')c=getchar();
while(c>='0'&&c<='9')
{
a=(a<<1)+(a<<3)+c-'0';
c=getchar();
}
}
inline const void write(LL a)
{
if(a>9)write(a/10);
putchar(a%10+'0');
}
inline const LL max(LL a,LL b)
{
if(a>b)return a;
return b;
}
LL n,m;
LL height[maxn<<2],lh[maxn<<2],rh[maxn<<2],lloc[maxn<<2],rloc[maxn<<2];
inline const void update(LL p)
{
height[p]=max(height[p<<1],height[p<<1|1]);
}
inline const void build(LL p,LL l,LL r)
{
if(l==r){read(height[p]);return ;}
LL mid=(l+r)>>1;
build(p<<1,l,mid);
build(p<<1|1,mid+1,r);
update(p);
}
inline const void push_col(LL p,LL l,LL r)
{
if(lh[p]||rh[p])
{
LL mid=(l+r)>>1;
push_col(p<<1,l,mid);push_col(p<<1|1,mid+1,r);
lh[p<<1]=lh[p<<1|1]=lh[p];rh[p<<1]=rh[p<<1|1]=rh[p];
lloc[p<<1]=lloc[p<<1|1]=lloc[p];rloc[p<<1]=rloc[p<<1|1]=rloc[p];
height[p<<1]=height[p]+max(lh[p<<1]*/+,rh[p<<1]*/+);
height[p<<1|1]=height[p]+max(lh[p<<1]*/+,rh[p<<1|1]*/+);
lh[p]=rh[p]=lloc[p]=rloc[p]=0;
}
}
inline const LL query(LL p,LL l,LL r,LL ll,LL rr)
{
if(l>=ll&&r<=rr)return height[p];
push_col(p);
LL mid=(l+r)>>1;LL ans=0;
if(mid>=ll)ans=max(query(p<<1,l,mid,ll,rr));
if(mid+1<=rr)ans=max(query(p<<1|1,mid+1,r,ll,rr));
return ans;
}
inline const void modify(LL p,LL l,LL r,LL ll,LL rr,LL lup,LL rup)
{
push_col(p,l,r);
if(l>=ll&&r<=rr)
{
push_col(p,l,r);
lloc[p]=ll;rloc[p]=rr;lh[p]=lup;rh[p]=rup;
return ;
}
LL mid=(l+r)>>1;
if(mid>=ll)modify(p<<1,l,mid,ll,rr,lup,rup);
if(mid+1<=rr)modify(p<<1|1,mid+1,r,ll,rr,lup,rup);
update(p);
}
int main()
{
read(n);
build(1,1,n);
read(m);
long long t,x,y,z,left;
while(m)
{
read(t);
if(t==1)
{
read(x);read(y);read(left);
modify(1,1,n,left,left+x-1,y,y);
}
if(t==2)
{
read(x);read(y);read(left);
modify(1,1,n,left,left+(y>>1),0,y);
modify(1,1,n,left+(y>>1),left+x-1,y,0);
}
if(t==3)
{
read(x);read(y);read(z);read(left);
if(z>0)
{
modify(1,1,n,left,left+z-1,0,y);
modify(1,1,n,left+z-1,left+y-1,y,y);
}
else
{
modify(1,1,n,,,y,0);
modify(1,1,n,,,y,y);
}
}
if(t==4)
{
read(x);read(y);
write(query(1,1,n,x,y));printf("\n");
}
m--;
}
return 0;
}