kaceqwq @ 2022-08-17 08:05:13
rt
by kaceqwq @ 2022-08-17 08:21:14
@JackMerryYoung 大佬,题目只要求最大值,不用求和,所以
by fajerwerki @ 2022-08-17 08:23:35
@JackMerryYoung 注意看
他写的是:
tree[p].sum += x;
并非
tree[p].sum += (l - r + 1) * x;
所以只是求最大值
by JackMerryYoung @ 2022-08-17 08:24:04
@neach__joup 太生草了,代码。
by kaceqwq @ 2022-08-17 08:24:47
对不起,我是蒟蒻
by ioker @ 2022-08-17 08:26:20
@kaceqwq 《昧子》
by fajerwerki @ 2022-08-17 08:28:01
@dpkajj 膜拜大佬
by fajerwerki @ 2022-08-17 08:28:43
@dpkajj c
验证码不给你面子
by Micnation_AFO @ 2022-08-17 08:28:50
@dpkajj 改了一下样例过了;
update2 里面递归调用的函数你写成 update1 了(
push_down 改成了这样:
void Push_down (int p) {
if (tree[p].flag) {
tree[p * 2].tag2 = 0;
tree[p * 2 + 1].tag2 = 0;
tree[p * 2].tag1 = tree[p].tag1;
tree[p * 2 + 1].tag1 = tree[p].tag1;
tree[p * 2].sum = tree[p].tag1;
tree[p * 2 + 1].sum = tree[p].tag1;
tree[p * 2].flag = tree[p * 2 + 1].flag = 1;
}
if (tree[p].tag2) {
tree[p * 2].sum += tree[p].tag2;
tree[p * 2 + 1].sum += tree[p].tag2;
tree[p * 2].tag2 += tree[p].tag2;
tree[p * 2 + 1].tag2 += tree[p].tag2;
}
tree[p].flag = tree[p].tag1 = tree[p].tag2 = 0;
}
by ioker @ 2022-08-17 08:30:04
@Leap_hash_jperm
You need to @kaceqwq
by ioker @ 2022-08-17 08:30:19
@neach__joup cd