随笔分类 -  树的全家桶/ 树形DP/ LCA/MST/树链剖分

摘要:北京市商汤科技开发有限公司建立了新的 AI 人工智能产业园,这个产业园区里有 nn 个路口,由 n - 1n−1 条道路连通。第 ii 条道路连接路口 u_iui​ 和 v_ivi​。 每个路口都布有一台信号发射器,信号频段是 11 到 mm 之间的一个整数。 道路所连接的两个路口的发射信号叠加可 阅读全文
posted @ 2019-05-30 20:27 茄子Min 阅读(429) 评论(0) 推荐(0)
摘要:Then n - 1n−1 lines follow. ii-th line contains two integers f_{a_i}(1 \le f_{a_i} < i)fai​​(1≤fai​​<i), w_i(0 \le w_i \le 10^{18})wi​(0≤wi​≤1018) —Th 阅读全文
posted @ 2019-05-29 18:56 茄子Min 阅读(703) 评论(0) 推荐(0)
摘要:题目描述 喜欢数学的wlswls最近被萎住了。 现在他一共有1...n1...n这么多数字,取数字ii会得到f[i]f[i]的收益。数字之间有些边,对于所有的i(i != 1)i(i!=1),若ii为奇数,则ii与3i+13i+1之间有边,否则ii与i/2i/2之间有边。如果一条边的两个顶点xyxy 阅读全文
posted @ 2019-05-22 17:06 茄子Min 阅读(388) 评论(0) 推荐(0)
摘要:Kuro is living in a country called Uberland, consisting of nn towns, numbered from 11to nn, and n−1n−1 bidirectional roads connecting these towns. It 阅读全文
posted @ 2019-04-14 13:53 茄子Min 阅读(378) 评论(0) 推荐(0)
摘要:Misha and Grisha are funny boys, so they like to use new underground. The underground has n stations connected with n - 1 routes so that each route co 阅读全文
posted @ 2019-02-21 21:24 茄子Min 阅读(341) 评论(0) 推荐(0)
摘要:链接:https://ac.nowcoder.com/acm/contest/330/G来源:牛客网 Applese 的毒气炸弹 Applese 的毒气炸弹 时间限制:C/C++ 2秒,其他语言4秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %l 阅读全文
posted @ 2019-01-29 23:55 茄子Min 阅读(226) 评论(0) 推荐(0)