摘要: tarjan求割点的模板题。 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=1e5+10; 4 int head[N],to[N<<1],nxt[N<<1],tot; 5 int dfn[N],low[N],st[N], 阅读全文
posted @ 2022-06-03 14:37 YHXo 阅读(37) 评论(0) 推荐(0)
摘要: 用tarjan变种求割边的模板题 其实还可以求出所有的边双(用栈),但本题不需要求。 1 #include<bits/stdc++.h> 2 using namespace std; 3 const int N=1e5+10; 4 int head[N],nxt[N<<1],to[N<<1],tot 阅读全文
posted @ 2022-06-03 11:41 YHXo 阅读(86) 评论(0) 推荐(0)
摘要: 树状数组加差分的应用。(线段树也可以这么用) 1 #include<bits/stdc++.h> 2 using namespace std; 3 int n,m; 4 long long t[500005]; 5 int lowbit(int x) {return x&(-x);} 6 7 voi 阅读全文
posted @ 2022-06-03 10:14 YHXo 阅读(33) 评论(0) 推荐(0)
摘要: 这道题看起来像是线段树和最大子段和的结合,但这里求最大子段和不用dp,充分利用线段树递归的优势来处理。个人理解:线段树相当于把求整个区间的最大子段和的问题不断划分为很多个小问题,容易解决小问题,然后递归处理较大的问题(分治),所以这就可以用来解决。 在线段树中,除了左端点,右端点,新开4个域——an 阅读全文
posted @ 2022-06-03 09:56 YHXo 阅读(46) 评论(0) 推荐(0)