树上的题
文章平均质量分 79
蒟蒻111
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[Apio2010]patrol 巡逻
题目大意:原创 2014-09-21 16:39:01 · 670 阅读 · 0 评论 -
经典离线求lca[模板]
#include #include #include #include #include #include #include #define maxn 600000#define maxm 1200000#define maxq 600000using namespace std;inline void read(int &x) { char ch; bool原创 2017-08-02 23:01:45 · 316 阅读 · 0 评论 -
POj 1741 树的点分治
看了漆子超的论文好像懂了一点点,就动手写了一下POJ1741。发现树的点分治其实也不是那么难,其主要流程好像就是不断地找当前子树的重心,处理重心的子树的答案,同时通过某种操作合并得到当前以重心为根的子树的答案。#include #include #include #include #include #include #include using namespace std;原创 2017-08-23 02:55:42 · 230 阅读 · 0 评论 -
Content Delivery
题目原文:You are given a computer network with n nodes. This network forms an undirected tree graph. The i-th edge connects the ai-th node with the bi-th node and its distance is ci. Every node has diff原创 2017-08-21 20:40:17 · 280 阅读 · 0 评论 -
Codeforces Round #430 (Div. 2) C Ilya And The Tree SET暴力
原题链接:http://codeforces.com/contest/842/problem/C大致题意:给出一颗有点权的树,令一个点的beauty值=在可以修改一个点的点权为零也可以不修改的情况下,从根节点到这个点的路上所有点的点权的总GCD。就是说,对于每一各点v, beauty(v)=gcd( val[a1],val[a2],val[a3]……,val[ak] ),a1……ak是从点原创 2017-09-01 13:19:26 · 240 阅读 · 0 评论 -
2017 ACM/ICPC Asia Regional Shenyang Online transaction
原题链接:http://acm.hdu.edu.cn/showproblem.php?pid=6201题目大意:一些城市及其之间的道路构成了一棵树。对于某一种物品,在城市 i 的价格是 ai单位金钱 ,而在道路上每走1单位长度就会花费1单位金钱。问任意选定买入该物品的城市和卖出该物品的城市,每个物品最大获利是多少。可以发现,如果一个城市的价格加上旅途费用后的单价比旅途终点的价格低,则在终点原创 2017-09-10 22:45:16 · 236 阅读 · 0 评论 -
codeforces 852E
原题链接:http://codeforces.com/problemset/problem/852/E大致题意:一个人在树形的城市网络上旅行,旅行的规则是参观完一个城市后随机走向另外一个未曾到过的城市,直到不能走到其他未走过的城市时结束。他的朋友可以在某些城市开赌场,使得这个人在经过这些开了赌场的城市时,心情值由0变为1,由1变为0。问有多少种方法来选择这个人旅行的起点和开赌场的城市来使得这个原创 2017-09-19 22:09:56 · 386 阅读 · 0 评论
分享