链接:https://ac.nowcoder.com/acm/contest/11255/E 来源:牛客网 题目描述 Bob has a tree with nn nodes and the weight of i-th node is wiwi. But Bob forgot ...
题意:给定N,M,然后给出M组信息 u,v,l,r ,表示u到v有 l,r 范围的通行证有效。问有多少种通行证可以使得 和N连通。 思路:和bzoj魔法森林有点像,LCT维护最小生成树。 开始和队友在想维护连通性,而不是维护树,这样好像会很麻烦。 队友yy了一个算法:用线段树模拟并查集维护连通性。 发现和标程有点像 我的代码:LCT维护最小生成树。 ...先给代码,后面补一下题解。 LCT代码: ...
2019-08-10 16:41 1 510 推荐指数:
链接:https://ac.nowcoder.com/acm/contest/11255/E 来源:牛客网 题目描述 Bob has a tree with nn nodes and the weight of i-th node is wiwi. But Bob forgot ...
目录 Contest Info Solutions A.Equivalent Prefixes B.Integration C.Euclidean Distance D.Parity of Tuples E ...
2019牛客暑期多校训练营(第一场) A.Equivalent Prefixes solved by RDC 42min -1, assisted by F0_0H 题意 给两个序列,求最长前缀使得笛卡尔树相同。 做法1 二分前缀,建笛卡尔树。 做法2 递归地计算 \([l,r ...
链接:https://ac.nowcoder.com/acm/contest/882/F来源:牛客网 Given 2N people, you need to assign each of them into either red team or white team ...
参考于: https://www.luogu.org/problemnew/solution/P4723 shadowice1984 (太难) https://www.cnblogs.com/zhgy ...
A. Eddy Walker solved by rdc 202min -1 题意 一个点在长度为 \(n\) 的环上游走,输出第一次访问到所有点时在 \(x\) 上的概率。 做法 考虑经典的线段上随游走问题,数轴上有 \(x=0\) 的 \(A\) 点,与 \(x=n\) 的 \(B ...
题目传送门 题号 A B C D E F G H I J 状态 ...
题目传送门 题号 A B C D E F G H I J 状态 ...