标签:
#include<cstdio>
#include<iostream>
#include<cstring>
#include<string>
#include<queue>
#include<cmath>
#include<algorithm>
#include<iomanip>
using namespace std;
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1|1
const int MX = 50055;
int sum[MX<<2];
void PushUp(int rt) {
sum[rt] = sum[rt<<1] + sum[rt<<1|1];
}
void Build(int l, int r, int rt) {
if (l == r) {
scanf("%d", &sum[rt]);
return ;
}
int m = (l + r)>>1;
Build(lson);
Build(rson);
PushUp(rt);
}
void Add(int pos, int add, int l, int r, int rt) {
if (l == r) {
sum[rt] += add;
return ;
}
int m = (l + r)>>1;
if (pos <= m) Add(pos, add, lson);
else Add(pos, add, rson);
PushUp(rt);
}
int Query(int L, int R, int l, int r, int rt) {
if (L <= l && r <= R) {
return sum[rt];
}
int m = (l + r)>>1;
int ret = 0;
if (L <= m) ret += Query(L, R, lson);
if (R > m) ret += Query(L, R, rson);
return ret;
}
int main() {
//freopen("input.txt", "r", stdin);
int Case = 0;
while (scanf("%d", &Case) != EOF) {
int sign = 0;
while (Case--) {
cout