随笔分类 - 树—杂项
摘要:题解 a_i \leq 2 10^5,所以每个a的质因数个数少于19个。保存每个结点的质因数,然后暴力更新每个结点的maxCnt(u,p_i)。并且同时记录答案。 maxCnt(u, p_i):=结点u的质因数p_i在以u为根的子树中最长的路径(以根为起点的到某点的路径
阅读全文
摘要:In a medieval kingdom, the economic crisis is raging. Milk drops fall, Economic indicators are deteriorating every day, money from the treasury disapp
阅读全文
摘要:XX星有许多城市,城市之间通过一种奇怪的高速公路SARS(Super Air Roam Structure 超级空中漫游结构)进行交流,每条SARS都对行驶在上面的Flycar限制了固定的Speed,同时XX星人对 Flycar的“舒适度”有特殊要求,即乘坐过程中最高速度与最低速度的差越小乘坐越舒服
阅读全文
摘要:某省调查乡村交通状况,得到的统计表中列出了任意两村庄间的距离。省政府“畅通工程”的目标是使全省任何两个村庄间都可以实现公路交通(但不一定有直接的公路相连,只要能间接通过公路可达即可),并要求铺设的公路总长度为最小。请计算最小的公路总长度。 Input测试输入包含若干测试用例。每个测试用例的第1行给出
阅读全文
摘要:Mr Wang wants some boys to help him with a project. Because the project is rather complex, the more boys come, the better it will be. Of course there
阅读全文
摘要:ice_cream's world is a rich country, it has many fertile lands. Today, the queen of ice_cream wants award land to diligent ACMers. So there are some w
阅读全文
摘要:A binary tree is a finite set of vertices that is either empty or consists of a root r and two disjoint binary trees called the left and right subtree
阅读全文
摘要:上次Gardon的迷宫城堡小希玩了很久(见Problem B),现在她也想设计一个迷宫让Gardon来走。但是她设计迷宫的思路不一样,首先她认为所有的通道都应该是双向连通的,就是说如果有一个通道连通了房间A和B,那么既可以通过它从房间A走到房间B,也可以通过它从房间B走到房间A,为了提高难度,小希希
阅读全文
![](https://images.cnblogs.com/cnblogs_com/zgglj-com/1682556/o_200327152908zg.jpg)