分治
growing_up_
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
poj 3714 分治加剪枝
//A #define _CRT_SECURE_NO_WARNINGS #include #include #include #include using namespace std; const double MAX_DIST = 1e100; const int MAXN = 200010; struct Point { double x, y; bool flag; };转载 2017-09-04 13:05:37 · 242 阅读 · 0 评论 -
codeforces 448C 分治
#include #include #define INF 0x3f3f3f using namespace std; const int maxn = 5005; int h[maxn]; int solve(int l, int r) { int Min = INF; int sum, flag = l; for (int i = l; i <=r; i++) { Min = m转载 2017-09-06 19:28:46 · 377 阅读 · 0 评论 -
poj1741 树分治
//poj1741 /* 给一棵边带权树,问两点之间的距离小于等于K的点对有多少个。 将无根树转化成有根树进行观察。满足条件的点对有两种情况:两个点的路径横跨树根,两个点位于同一颗子树中。 如果我们已经知道了此时所有点到根的距离a[i],a[x] + a[y] <= k的(x, y)对数就是结果,这个可以通过排序之后O(n)的复杂度求出。然后根据分治的思想,分别对所有的儿子求一遍即可,但是这会出转载 2017-09-07 21:34:43 · 278 阅读 · 0 评论
分享