基本上算是抄的代码。。。。
线段树,维护一个sum数组,sum数组存的是当前区间段以第1-5个数为起点的间隔为5的数的总和
离线化处理也是以前从没有见过的
code:
#include <cstdio>
#include <cstring>
#include <iostream>
#include <algorithm>
#define LL __int64
using namespace std;
const int MAXN = 110005;
struct seg
{
int left,right,cnt;
LL sum[5];
}tree[MAXN<<2];
void build(int rt,int l,int r)
{
tree[rt].left=l;
tree[rt].right=r;
tree[rt].cnt=0;
......
阅读全文