
树上
文章平均质量分 83
做不完的ACM
加油,努力
展开
-
HDU5927
题意:给定一棵以1为根的n个节点的树,多个询问,每次询问给出一个集合,集合内的点表示为不重要的点(不在集合内的点就是重要的点),求给定这个集合后有多少点能进入另一个集合,点x进入另一个集合的要求:1:重要的点。2:有两个重要的点的最近公共祖先为x。分析:其实对于每一个询问我们只要判断哪些不重要的点是能进入集合的,那么对于一个不重要的点x,怎样才能进入集合呢?我们先dfs对于所有的点求出fa[x]和原创 2018-01-26 23:46:27 · 266 阅读 · 0 评论 -
第十六届金马五校 B:
链接:https://www.nowcoder.com/acm/contest/91/B来源:牛客网题目描述 在埃森哲,员工培训是最看重的内容,最近一年,我们投入了 9.41 亿美元用于员工培训和职业发展。截至 2018 财年末,我们会在全球范围内设立 100 所互联课堂,将互动科技与创新内容有机结合起来。按岗培训,按需定制,随时随地,本土化,区域化,虚拟化的培训会让你快速取得成长。小埃希望能通...原创 2018-04-16 21:38:00 · 253 阅读 · 0 评论 -
中南大学第十二届大学生程序设计竞赛 D树上异或性质
题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=2082DescriptionThe environment of Beijing is insufferable as you know.You have to wear a mask when you go outside because of the smog. Xiaoming ...原创 2018-04-24 10:14:33 · 242 阅读 · 0 评论 -
SPOJ:Ada and Orange Tree (LCA+Bitset)
题目链接:https://vjudge.net/problem/SPOJ-ADAORANGAda the Ladybug lives near an orange tree. Instead of reading books, she investigates the oranges. The oranges on orange tree can be in up to 5*50 Shades o...原创 2018-04-24 19:21:15 · 304 阅读 · 0 评论 -
Codeforces 980E(树上贪心倍增)
题目链接: http://codeforces.com/contest/980/problem/EE. The Number Gamestime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe nation of Panel holds an a...原创 2018-05-09 22:54:33 · 1475 阅读 · 0 评论 -
Codeforces 965E 启发式合并
http://codeforces.com/contest/965/problem/EE. Short Codetime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputArkady's code contains nn variables. Each v...原创 2018-04-27 18:42:00 · 374 阅读 · 0 评论 -
CF 980E(树上差分)树状数组
题目链接: http://codeforces.com/contest/980/problem/EE. The Number Gamestime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe nation of Panel holds an a...原创 2018-05-18 22:34:24 · 334 阅读 · 0 评论 -
Codeforces 990G. GCD Counting
题目连接:http://codeforces.com/contest/990/problem/G题目描述:G. GCD Countingtime limit per test4.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a tree consist...原创 2018-06-13 20:18:25 · 658 阅读 · 0 评论 -
Codeforces 1004E
题目链接:http://codeforces.com/contest/1004/problem/E题目描述: 题意: 简单来说就是给你一颗n个节点的树,然后你自己选择一条长度不超过k个节点的路径(必须是一条树上的路径)。将这条路径看成一个点,问这个点到树上其他点的最远距离是多少? 题解:首先找到树的一条直径(两次DFS)。并且处理出直径起点到其他点的距离。 ...原创 2018-07-18 15:42:45 · 276 阅读 · 0 评论