维护序列
解题思路
线段树模板题
code
#include<iostream>
#include<cstdio>
#define int long long
using namespace std;
int n,m,mod;
struct abc{
int s;
int flg1,flg2;
}tree[400010];
void build(int now,int l,int r)
{
tree[now].flg1=1;
if(l==r)
{
scanf("%lld",&tree[now].s);
return;
}
int mid=(l+r)/2;
build(now*2,l,mid);
build(now*2+1,mid+1,r);
tree[now].s=(tree[now*2].s+tree[now*2+1].s)%mod;
}
void down(abc &now,abc &l,abc &r,int x,int y)
{