正文
增加 2 行删除 2 行
17 行未改动1819202122232425262728293031323334353639 行未改动17 行未改动void pushup(int u){w[u] = w[u << 1] + w[u << 1 | 1];}void build(int u, int L, int R){if(L == R){w[u] = a[L];return;}int M = (L + R) >> 1;build(u << 1, L, M); build(u << 1 | 1, M + 1, R);pushup(u);}void update(int u, int L, int R, int x, int y){if(L == R){w[u] = y;return;}int M = (L + R) >> 1;if(x <= M) update(u << 1, L, M, x, y);39 行未改动17 行未改动1819202122232425262728293031323334353639 行未改动17 行未改动void pushup(int u){w[u] = w[u << 1] + w[u << 1 | 1];}void build(int u, int L, int R){if(L == R){w[u] = a[L];return;}int M = (L + R) >> 1;build(u << 1, L, M); build(u << 1 | 1, M + 1, R);pushup(u);}void update(int u, int L, int R, int x, int y){if(L == R){w[u] = y;return;}int M = (L + R) >> 1;if(x <= M) update(u << 1, L, M, x, y);39 行未改动