Empty_Dream @ 2023-12-27 22:04:48
此题建议升绿,代码量较大,属于板子但思路不容易想到,并且属于【6】级知识点,评黄感觉有点低,绿差不多。(违规紫衫
by yydfj @ 2023-12-29 20:20:54
无法理解,依我看画个简单的图就能理解其中的工作原理,而不画图就有点抽象不能代表它思维难度大,除非你画了图也不是很好理解。
by yydfj @ 2023-12-29 20:24:09
觉得难可能是找不到合适自己学习的资料?毕竟这题的题解区不像oiwiki那样画图来解释,会有点抽象。
by __Cby___ @ 2023-12-29 20:33:29
https://www.luogu.com.cn/discuss/753113
by Empty_Dream @ 2023-12-29 21:34:38
@_ll 或者不能是思维复杂,单这个码量还是相对其它黄题较大的
by _l_l_ @ 2023-12-30 15:18:18
感觉码量不大吧,这是我刚刚现码的东西:
namespace sgt {
ll val[MAXN << 2], tag[MAXN << 2];
void addtag(int rt, int l, int r, ll w) {val[rt] += (r - l + 1) * w; tag[rt] += w;}
void pushdown(int rt, int l, int r) {
int mid = (l + r) >> 1; if (tag[rt]) {
addtag(rt << 1, l, mid, tag[rt]); addtag(rt << 1 | 1, mid + 1, r, tag[rt]); tag[rt] = 0;
}
}
void pushup(int rt) {val[rt] = val[rt << 1] + val[rt << 1 | 1];}
void build(int rt, int l, int r, ll *a) {
if (l == r) return val[rt] = a[l], void(); int mid = (l + r) >> 1;
build(rt << 1, l, mid, a); build(rt << 1 | 1, mid + 1, r, a); pushup(rt);
}
void modify(int rt, int l, int r, int x, int y, ll w) {
if (x <= l && r <= y) return addtag(rt, l, r, w); int mid = (l + r) >> 1; pushdown(rt, l, r);
if (x <= mid) modify(rt << 1, l, mid, x, y, w); if (y > mid) modify(rt << 1 | 1, mid + 1, r, x, y, w); pushup(rt);
}
ll query(int rt, int l, int r, int x, int y) {
if (x <= l && r <= y) return val[rt]; int mid = (l + r) >> 1; pushdown(rt, l, r); ll ans = 0;
if (x <= mid) ans += query(rt << 1, l, mid, x, y); if (y > mid) ans += query(rt << 1 | 1, mid + 1, r, x, y);
return ans;
}
}
而且我代码中含有非常多空格,实际码量更短
by N1008_9 @ 2024-01-03 14:47:33
玩原神玩的
by CWzwz @ 2024-01-03 19:20:25
怎么突然来把线段树 1 给升绿了,啥玩意
by tmpliyijiang @ 2024-01-06 12:37:47
ACAM 三个板子都是蓝!
by Nephren_Sakura @ 2024-01-06 16:20:18
我觉得完全没有绿啊
by lishengkai @ 2024-01-09 18:58:28
反对反对反对