看马蜂猜人

欢迎投稿

#1

void Build(int rt, int l, int r)
{
	tree[rt].l = l;
	tree[rt].r = r;
	if(l == r)
	{
		tree[rt].sum = a[l];
		return;
	}
	
	int mid = (l + r) >> 1;
	Build(lson, l, mid);
	Build(rson, mid+1, r);
	
	pushup(rt);
}

#2

void jian(int k,int l,int r){
	if(l==r)tr[k].sum=a[l];
	else{
		int mid=(l+r)>>1;
		jian(k<<1,l,mid);
		jian(k<<1|1,mid+1,r);
		geng(k);
	}
}

#3

struct Data
{
	struct Ver { int sum, laz; } V[N<<2];
	
	void Pushup ( int p ) { V[p].sum = ( V[p<<1].sum + V[p<<1|1].sum ) % Mod; }

	void Laz ( int p, int l, int r, int d ) { V[p].laz = ( V[p].laz + d ) % Mod, V[p].sum = ( V[p].sum + 1LL * d * (r-l+1) ) % Mod; }

	void Pushdown ( int p, int l, int r ) { int mid = l + (r-l>>1); if( V[p].laz ) Laz( p<<1, l, mid, V[p].laz ), Laz( p<<1|1, mid+1, r, V[p].laz ), V[p].laz = 0; }

	void Modify ( int p, int l, int r, int x, int y, int d )
	{
		if( x <= l && r <= y ) return Laz( p, l, r, d ), void();
		Pushdown( p, l, r );
		int mid = l + (r-l>>1);
		if( x <= mid ) Modify( p<<1, l, mid, x, y, d); if( y > mid ) Modify( p<<1|1, mid+1, r, x, y, d);
		Pushup( p );
	}

	int Query ( int p, int l, int r, int x, int y )
	{
		if( x <= l && r <= y ) return V[p].sum;
		Pushdown( p, l, r);
		int mid = l + (r-l>>1), res1 = 0, res2 = 0;
		if( x <= mid ) res1 = Query( p<<1, l, mid, x, y ); if( y > mid ) res2 = Query( p<<1|1, mid+1, r, x, y );
		return ( res1 + res2 ) % Mod;
	}
}F, G;
}

#4

应本人要求做出了修改

namespace Wisadel
{
    void Wbuild(int rt,int l,int r)
    {
        if(l==r)
        {
            maxn[rt]=minn[rt]=sum[rt]=a[l];
            return;
        }
        Wbuild(ls,l,mid),Wbuild(rs,mid+1,r);
        Wpushup(rt);
    }
}

#5

signed main(){
	std::cin>>a>>b;
	std::cout<<mo(a+b)<<std::endl;
}

#6

为了更加契合本人所以略微修改

int a, b, c;
int A(){ return a / c; }
int B(){ return c / b + a; }
struct D{
	int e,f;
};
vector<d> g;
void C(){ g.push_back( D{a, c} ); }
int main(){
	A(); B(); C();
}

#7

auto plus=[](int x,int y){
	return x+y;
}
int main(){
	int x,y,z;
	read(x,y,z);
	if(plus(x,y)==plus(y,z) and plus(y,z)==plus(z,x)){
		cout<<"True";
	}
	else cout<<"False";
}

#8

来自投稿

	public:
		void Build () {
			if (l != r) {
				bdmd;
				ls = new Node (l, mid), ls->Build ();
				rs = new Node (mid + 1, r), rs->Build ();
			}
			return;
		}

#9

来自投稿

struct Disjoint_Set
{
	#define N 20002
	int fa[N],siz[N];
	il void pre(int x)
	{
		for(ri i=1;i<=x;i++)
		{
			fa[i]=i;
			siz[i]=1;
		}
	}
	int find(int x)
	{
		if(fa[x]!=x)
		{
			fa[x]=find(fa[x]);
		}
		return fa[x];
	}
	bool merge(int x,int y)
	{
		ri fx=find(x),fy=find(y);
		if(fx==fy)
		{
			return false;
		}
		if(siz[fx]<siz[fy])
		{
			swap(fx,fy);
		}
		fa[fy]=fx;
		siz[fx]+=siz[fy];
		return true;
	}
	#undef N
}tree;

#10

来自投稿

valueType N, Q, S;
// ValueVector Up, Down, Left, Right; // 矩阵四周的边界,用于确定方向。规定四条边的方向为:上下左右。
std::array<valueType, MaxN> Up, Down, Left, Right;
// ListMatrix Transfer;               // 节点的转移边,要求第 0 条和第 1 条边的方向相反,第 2 条和第 3 条边的方向相反。
std::array<ValueList, MaxN * MaxN> Transfer;
// ListMatrix Difference;             // 转移边的边权,要求在断边连边操作之前边权为 0。
std::array<ValueList, MaxN * MaxN> Difference;
// ValueVector TempWeight;            // 临时存储节点的点权,用于在断边连边操作之前将点权下放。
std::array<valueType, MaxN * MaxN> TempWeight;

#11

来自投稿

namespace S
{
    using namespace E;
    const int MAXN=8e5+10,MAXT=1e7+10;
    int root[MAXN],cnt;
    struct node{ll sum;int num,ls,rs;}t[MAXT];
    void change(int x,int pos,int p,int q)
    {
        t[q]=t[p],t[q].num++;if(x<=n) return ;
        if(r[s[x][0]]>=dfn[pos])
        {
            change(s[x][0],pos,t[p].ls,t[q].ls=++cnt);
            t[t[q].ls].sum+=T::dis(pos,E::pos[x]);
        }
        else
        {
            change(s[x][1],pos,t[p].rs,t[q].rs=++cnt);
            t[t[q].rs].sum+=T::dis(pos,E::pos[x]);
        }
    }
    ll query(int x,int pos,int p,int q)
    {
        if(x<=n) return 0;ll ans=0;
        if(r[s[x][0]]>=dfn[pos])
        {
            ans=query(s[x][0],pos,t[p].ls,t[q].ls);
            ans+=T::dis(pos,E::pos[x])*(t[t[q].rs].num-t[t[p].rs].num);
            ans+=t[t[q].rs].sum-t[t[p].rs].sum;
        }
        else
        {
            ans=query(s[x][1],pos,t[p].rs,t[q].rs);
            ans+=T::dis(pos,E::pos[x])*(t[t[q].ls].num-t[t[p].ls].num);
            ans+=t[t[q].ls].sum-t[t[p].ls].sum;
        }
        return ans;
    }
    inline void upd(int i)
        {change(R,p[i],root[i-1],root[i]=++cnt);}
    inline ll qry(int l,int r,int x)
        {return query(R,x,root[l-1],root[r]);}
    
};
posted @ 2024-09-08 17:25  HaneDaniko  阅读(144)  评论(37编辑  收藏  举报