# 3389. 线段树：点增加

(相比线段树:)

#include <bits/stdc++.h>
using namespace std;

#define pushup(x) T[x]=T[x<<1]+T[x<<1|1]
const int maxn = 500005;
int n, m, M;
long long T[maxn<<4];

inline void build()
{
for (M = 1; M <= n+1; M <<= 1);
for (int i = M+1; i <= M+n; ++i) scanf("%lld", T+i);
for (int i = M-1; i; --i) pushup(i);
}

inline void update(int x, int y)
{
for (T[x+=M] += y, x>>=1; x; x>>=1) pushup(x);
}

inline void query(int s, int t)
{
long long ans = 0;
for (s += M-1, t += M+1; s^t^1; s>>=1, t>>=1)
{
if (~s&1) ans += T[s^1];
if (t&1) ans += T[t^1];
}
printf("%lld\n", ans);
}

int main()
{
int op, x, y;
scanf("%d", &n);
build();
scanf("%d", &m);
while (m--)
{
scanf("%d%d%d", &op, &x, &y);
(op == 1) ? update(x, y) : query(x, y);
}
return 0;
}


TLE的兄弟们可以把cin全换成scanf，cout换成printf

#include <bits/stdc++.h>
using namespace std;
typedef long long long_int;
const int maxn = 550000;
long_int Tree[maxn];
int n , m;
inline int lowbit(int x){ return x&(-x); }
for (int i = x ; i <= n ; i += lowbit(i))
Tree[i] += val;
}
long_int get(int x){
long_int sum = 0;
for (int i = x ; i ; i -= lowbit(i))
sum += Tree[i];
return sum;
}

int main(){
cin >> n;
long_int x = 0;
for (int i = 1 ; i <= n ; ++i){
scanf("%lld",&x);
}
cin >> m;
int a = 0 , y = 0 , z = 0;
while(m--){
scanf("%d%d%d",&a,&y,&z);
if(a == 1)