- 博客(42)
- 收藏
- 关注
原创 基础图论算法导引
ACM中常用图论算法1. 拓扑排序 -> 拓扑排序的原理及其实现2. 最短路径算法 -> 最短路算法总结 差分约束系统 -> 差分约束 前k短路 -> 前K短路径问题3. 最小生成树问题扩展 -> 最小生成树问题的拓展 最优比率生成树 -> 最优比率生成树 最小k度限制生成树 -> IOI2004国家集训队论文,由汪汀所著(网盘
2014-08-18 19:14:34 1526 2
原创 【几何】HDU 1007 Quoit Design 最近点对
模板#include#include#include#include#include#include#include#includeusing namespace std;#include#include#include#include#include#includestruct Q{ double x, y;} q[100001], sl[10],
2014-08-28 18:25:28 701
原创 【字典树】POJ 2418 Hardwood Species
嘀嘀嘀有人知道 重载的时候 加了 sz=1;就一直CE怎么破???如果有人看到能教教我吗??我还不会c++弱菊不胜感谢!Orz#include#include#include#include#include#include#include#includeusing namespace std;#include#include#include#include#inc
2014-08-28 15:35:53 910
原创 Codeforces 461A Appleman and Toastman
思路需要#include#include#include#include#include#include#include#include#includeusing namespace std;#include#include#include#include#include#includeconst int INF = 0x3f3f3f3f;__int64 s[
2014-08-27 13:45:43 795
原创 【最小割】HDU 4971 A simple brute force problem.
说是最大权闭合图....比赛时没敢写....题意一共有n个任务,m个技术完成一个任务可盈利一些钱,学习一个技术要花费钱完成某个任务前需要先学习某几个技术但是可能在学习一个任务前需要学习另几个任务求最多能赚多少钱咯先将缩点将需要一起学掉的技术缩成一个点建s--任务 权值为该任务盈利多少钱建技术(缩点后)-t 权值为学习这技术的花费(总)任务-技术
2014-08-21 22:30:26 1252
原创 【线段树】HDU 3397 Sequence operation 区间合并
操作Change operations:0 a b change all characters into '0's in [a , b]1 a b change all characters into '1's in [a , b]2 a b change all '0's into '1's and change all '1's into '0's in [a, b]Out
2014-08-20 10:50:58 996
原创 【瞎搞】HDU 4968 Improving the GPA
枚举一种GPA有多少个总分1加上该GPA的最小分数总分2加上该GPA的最大分数若总分1则可以在枚举的状态达到目标分数#include #include #include #include #include using namespace std;#define IN freopen ("in.txt" , "r" , stdin);#define OUT
2014-08-19 19:50:20 925
原创 【线段树】HDU 3308 LCIS
嘀嘀嘀两种操作:#include #include #include #include #include #include #include using namespace std;#include #include #include #include #include #include #define IN freopen ("in.txt"
2014-08-18 18:45:08 743
原创 【树状数组】CF 459D Pashmak and Parmida's problem
ddd#include #include #include #include #include #include #include using namespace std;#include #include #include #include #include #include #define IN freopen ("in.txt" , "r" , stdin
2014-08-18 10:24:27 796
原创 【凸包】HDU 4946 Area of Mushroom
注意:1.重合的点2.速度为0的点#include #include #include #include #include #include #include #include #include using namespace std;#include #include #include typedef long long LL;#define lson l
2014-08-14 20:08:06 713
原创 【最大流】HDU 4292 Food
s-食物-人-人-饮料-t#include #include #include #include #include #include #include using namespace std;#include #include #include #include #include #include typedef long long LL;const int M
2014-08-09 19:40:22 663
原创 HDU 1599 floyd 最小环
最小环证明:一个环中的最大结点为k(编号最大),与他相连的两个点为i,j,这个环的最短长度为g[i][k]+g[k][j]+i到j的路径中,所有结点编号都小于k的最短路径长度根据floyd的原理,在最外层循环做了k-1次之后,dist[i][j]则代表了i到j的路径中,所有结点编号都小于k的最短路径综上所述,该算法一定能找到图中最小环
2014-08-06 19:16:57 684
原创 HDU4920 Matrix multiplication 矩阵
不要问窝 为什么过了> <窝也不造为什么就过了 说是%3变成稀疏矩阵 但是随便YY个案例都会超时。。。看来数据是随机的诶
2014-08-05 19:46:11 787
原创 HDU 3466 Proud Merchants 条件限制01背包
比如A:p1 q1, B:p2 q2, 然后,假设单独买A或者B的话,都是可以买到的。 这时,若先买A,则你至少需要p1+q2的钱; 若先买B,则至少需要p2+q1的钱。那肯定是花最少的钱咯, 所以如果先买A再买B,那么p1+q2 就是q1-p1>q2-p2,也就是说qi-pi大的先买。#include #include #include #include
2014-08-04 21:43:56 673
原创 HDU 2639 Bone Collector II 背包k优解
其基本思想是将每个状态都表示成有序队列,将状态转移方程中的max/min转化成有序队列的合并。这里仍然以01背包为例讲解一下。首先看01背包求最优解的状态转移方程:f[i][v]=max{f[i-1][v],f[i-1][v-c[i]]+w[i]}。如果要求第K优解,那么状态f[i][v]就应该是一个大小为K的数组f[i][v][1..K]。其中f[i][v][k]表示前i个物品、背包大小为v
2014-08-04 20:35:35 565
原创 【DP】UVA 624 CD 记录路径
开一个数组p若dp[i-1][j]递归输出p#include #include #include #include #include #include #include #include #include#include using namespace std;#define MAXN 11111#include #include #define I
2014-08-04 10:35:48 851
原创 POJ 3119 Friends or Enemies?
先预处理得到各个编号的点的位置再判断 点在二元一次方程的上方还是下方#include #include #include #include #include #include #include #include #include#include using namespace std;#define MAXN 11111#include #include struct
2014-08-02 20:42:38 917
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人