摘要: 一,无向图的割点与桥 对于G=(V,E) 1.割点:xξV若删除x以及与x所连边后,图被分裂成为多个联通图,则x为图的割点 2.桥(割边):eξE若删除e后图,图被分裂成为多个联通图,则e为图的割点 怎样求割点与割边 tarjan算法 就是他了。。。 首先我们引入时间戳的概念 设dfsn[x]表示从 阅读全文
posted @ 2018-03-30 15:26 lmjer 阅读(520) 评论(0) 推荐(0) 编辑
摘要: Sightseeing trip Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 7483 Accepted: 2827 Special Judge Description There is a travel agency in 阅读全文
posted @ 2018-03-29 19:23 lmjer 阅读(178) 评论(0) 推荐(0) 编辑
摘要: 题目描述 C 国有 n 个大城市和 m 条道路,每条道路连接这 n 个城市中的某两个城市。任意两个城市之间最多只有一条道路直接相连。这 m 条道路中有一部分为单向通行的道路,一部分为双向通行的道路,双向通行的道路在统计条数时也计为 1 条。 C 国幅员辽阔,各地的资源分布情况各不相同,这就导致了同一 阅读全文
posted @ 2018-03-24 22:12 lmjer 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 4919: [Usaco2009 Jan]Telephone Lines Description 在郊区有N座通信基站,P条双向电缆,第 i 条电缆连接基站 A_i 和 B_i。特别地,1号基站是通信公司的总站,N 号基站位于一座农场中。现在,农场主希望对通信线路进行升级,其中升级第 i 条电缆需要 阅读全文
posted @ 2018-03-23 19:31 lmjer 阅读(179) 评论(0) 推荐(0) 编辑
摘要: Description 您需要写一种数据结构(可参考题目标题),来维护一些数,其中需要提供以下操作: 1. 插入x数 2. 删除x数(若有多个相同的数,因只删除一个) 3. 查询x数的排名(若有多个相同的数,因输出最小的排名) 4. 查询排名为x的数 5. 求x的前驱(前驱定义为小于x,且最大的数) 阅读全文
posted @ 2018-03-21 19:15 lmjer 阅读(183) 评论(0) 推荐(0) 编辑
摘要: 什么是最大子段和?顾名思义,在一个序列中,找到一段,将这一段元素相加使得结果最大. 其实可以通过递推来在O(n)的时间复杂度内求出结果,也就是判断一个数前面一个数能否对最大子段和作贡献.如果前面那个数>0,那么就将它加到这一个数里,每次正在操作的数进行取max.但是这样不能在线查询(虽然这个题也不需 阅读全文
posted @ 2018-03-18 10:53 lmjer 阅读(159) 评论(0) 推荐(0) 编辑
摘要: 把一个区间的操作换作转化为左右端点的操作然后通过前缀和得到答案 #include<cstdio> #include<algorithm> #include<cstring> #include<map> using namespace std; map<pair<int,int>,bool>check 阅读全文
posted @ 2018-03-15 18:20 lmjer 阅读(229) 评论(0) 推荐(0) 编辑
摘要: #include<cstdio>#include<algorithm>using namespace std;const int maxn=5000;int a[maxn],b[maxn];int dp[maxn];int main(){ int n; scanf("%d",&n); for (in 阅读全文
posted @ 2018-03-13 18:18 lmjer 阅读(102) 评论(0) 推荐(0) 编辑
摘要: #include<cstdio>#include<cmath>#include<cstring>#include<iostream>#include<algorithm>using namespace std;const int N=250005;//const int M=200005;int n 阅读全文
posted @ 2018-03-11 11:25 lmjer 阅读(133) 评论(0) 推荐(0) 编辑
摘要: #include<cstdio>#include<cstring>#include<algorithm>using namespace std;const int maxn=60;const int nil=(1<<29);int a[maxn];int dp[maxn][maxn];int mai 阅读全文
posted @ 2018-03-08 18:53 lmjer 阅读(121) 评论(0) 推荐(0) 编辑