- 博客(12)
- 资源 (5)
- 收藏
- 关注
原创 HDU 2255 奔小康赚大钱 (KM算法 模板)
A - 奔小康赚大钱 Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Description 传说在遥远的地方有一个非常富裕的村落,有一天,村长决定进行制度改革:重新分配房子。 这可是一件大事,关系到人民的住房问题啊。村里共有n间房间
2015-08-17 11:44:44 731
原创 UVA 348 Optimal Array Multiplication Sequence(最优矩阵链乘)
L - Optimal Array Multiplication Sequence Time Limit:3000MS Memory Limit:0KB 64bit IO Format:%lld & %llu Submit Status Practice UVA 348 Appoint description: acmparand (2013-08-02
2015-08-09 20:25:21 666
原创 POJ 3368 Frequent values
B - Frequent values Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3368 Appoint description: bjtu_lyc (2011-08-08)System Crawler (
2015-08-09 11:48:13 556
原创 POJ 3264 Balanced Lineup(st或者线段树)
A - Balanced Lineup Time Limit:5000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u Submit Status Practice POJ 3264 Appoint description: System Crawler (2015-08-03) Des
2015-08-09 00:29:03 1135
原创 Codeforces Round #312 (Div. 2) B. Amr and The Large Array
这道题对技巧和思维都是不错的锻炼。求出现最多次数的那个数在保持出现次数不变的情况下数组的最短长度。 思路: 1用一个vis数组来标记数组中每个数字出现的次数,可以边输入边判断,在线性时间内处理处出现次数最多的次数。注意不是那个数,因为出现的最大次数相同的数可能有多个。 2线性时间扫一遍,处理处每个数的最左和最右端点的编号和区间的长度。 3线性时间再扫一遍,这次只要在出现最大次数相同的数之间比较区间,即可找出出现次数最大且长度最短的子数组。
2015-08-07 23:55:11 469
原创 Lala Land and Apple Trees
A. Lala Land and Apple Trees time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Amr lives in Lala Land. Lala La
2015-08-07 23:22:10 800
原创 最大流 dinic算法模板
算法思想:1 bfs构造残量层次图2 dfs沿着层次的残量图找增广路3 当前弧优化,用cur[u]保存u访问到第几条边,相当于记忆化,下次就不用从u的第一条边开始#include #include #include #include #include #include using namespace std; #define maxn 1005 #define inf 0x3f3f3f3f int
2015-08-07 15:09:56 648
原创 HDU 3549 Flow Problem
最大流的一些基本概念: 1 流量flow: u->v 的流量为f,则相反方向的v->u的流量为-f 2 容量cap:u->v的容量为c,但v->u的容量为0.(本来图中不存在的边容量都为0) 3 残量cp=容量-流量。cp(u->v)=cap(u->v)-flow(u->v); 4 增广路:在残量图中,一条从起点s到终点t的路径,且该路径上的所以残量的最小值要大于0. 最大流ekrap算法的思想:(其实就是找增广路一步步逼近最大流) 1不停的找增广
2015-08-06 22:47:02 488
原创 hdu 2586 How far away?
A - How far away ? Time Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64u Submit Status Description There are n houses in the village and some bidirectional roads
2015-08-05 23:26:36 537
原创 POJ 1330 Nearest Common Ancestors
lca的tarjan离线算法 #include #include #include #include #include using namespace std; #define maxn 10505 int fa[maxn],ance[maxn]; vectorg[maxn],query[maxn]; bool vis[maxn]; int in[maxn]; int n,m;
2015-08-05 14:48:54 433
原创 无向图的点双连通分量(tarjan模板)
#include #include #include #include #include #include using namespace std; #define maxn 7500 #define inf 0x3f3f3f3f int n,m; int g[maxn][maxn]; int clock; int low[maxn],pre[maxn]; stacks; int bc; vect
2015-08-01 17:38:36 2056 1
原创 无向图的割顶和桥(tarjan模板)
#include #include #include #include using namespace std; #define maxn 7500 #define inf 0x3f3f3f3f int first[maxn],to[maxn],nxt[maxn],e; int pre[maxn],low[maxn]; int clock; int iscut[maxn]; void add(in
2015-08-01 15:32:23 747
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人