![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
点分治
Lifel
dcoi 蒟蒻一枚 欢迎交流~~~qq:1627767186
展开
-
poj1741点分治
点分治一般按点分为两种情况: 1:过该点,则遍历统计答案 2:不过,递归到子树重心统计 然后合并答案#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<algorithm>#define fo(i,a,b) for(int i=a;i<=b;i++)#define fod(i,a,b)原创 2017-09-10 19:40:18 · 297 阅读 · 0 评论 -
bzoj2152点分治
考虑三的倍数的计算: 即t[1]∗t[2]+t[0]2t[1]*t[2]+t[0]^2(每一个点对都计算两次),然后用整个点减去只在子树中出现的即可#include<iostream>#include<cstdio>#include<cmath>#include<cstring>#include<algorithm>#define fo(i,a,b) for(int i=a;i<=b;i原创 2017-09-10 19:45:13 · 309 阅读 · 0 评论