摘要: 貌似是套路题. 假设给定我们一些区间,那么这些区间交集的左端点是左端点最靠右区间的左端点. 所以我们将所有区间按照左端点从小到大排序,然后用堆维护前 k 大的右端点. 那么,对于枚举到的第 $i$ 个区间来说,右端点就是第 $k$ 大的右端点与当前区间右端点的较小值. code: #include 阅读全文
posted @ 2019-12-28 16:51 EM-LGH 阅读(114) 评论(0) 推荐(0) 编辑
摘要: 推一推式子后发现每个点不论走几步被访问到的概率都是 $\frac{d_{i}}{2m}$ code: #include <cstdio> #include <string> #include <algorithm> #define N 100070 #define ll long long #def 阅读全文
posted @ 2019-12-28 16:10 EM-LGH 阅读(128) 评论(0) 推荐(0) 编辑
摘要: code: #include <cstdio> #include <string> #include <algorithm> #define N 200007 #define ll long long using namespace std; namespace IO { void setIO(st 阅读全文
posted @ 2019-12-28 15:30 EM-LGH 阅读(106) 评论(0) 推荐(0) 编辑
摘要: 和【洛谷5115】挺像的. 都是统计信息的时候是包含两个树的,那就在一个树上边分治,另一个树上跑一个虚树dp就好了. 式子这么拆: $dep[i]+dep[j]-(dep[LCA(i,j)]+dep'[LCA'(i,j)]$ $\Rightarrow dep[i]+dep[j]-\frac{1}{2 阅读全文
posted @ 2019-12-28 14:25 EM-LGH 阅读(142) 评论(0) 推荐(0) 编辑