题意 题目链接 Sol ODT板子题. 操作1直接拆区间就行. #include<bits/stdc++.h> #define fi first #define se second const int MAXN = 2e5 + 10; using namespace std; inline int read() { char c = getchar(); int x = 0, f = 1; while(c < '0' || c > '9') {if(c == '-') f = -1…
前言 这道题目呢,看上去很难,实际上我们可以用线段树解决这道题目. 正文 我们维护 sum.len.tag.lmax.rmax.ans. sum 就是这段区间非脑洞的个数 len 就是这段区间的长度 tag 就是我们的 lazy_tag lmax 就是从左开始的连续脑洞个数 rmax 就是从右开始的连续脑洞个数 ans 就是这段区间最大的连续脑洞 建树 由于 len 是不变的,所以我们可以建树的时候就求出 len t[num].len=r-l+1; pushup sum sum 就是左子树和右子…