摘要:
Design the city 【题目链接】 " Design the city " 【题目类型】 LCA tarjan &题意: 给一个无根树,有q个询问,每个询问3个点,问将这3个点连起来,距离最短是多少 &题解: 我们可以求出2点距离,用O(n+q)的复杂度,那么怎么把他转化成这个才是关键,你 阅读全文
摘要:
How far away &题解: 和上篇是一样的题,这用的是lca方法做的, 不知道为什么,把数组开到80000 就a了 _ &代码: c++ include include include include include include include include include inclu 阅读全文
摘要:
How far away 【题目链接】 " How far away " 【题目类型】 dfs+邻接表 &题意: 题目大意:一个村子里有n个房子,这n个房子用n 1条路连接起来,接下了有m次询问,每次询问两个房子a,b之间的距离是多少。 &题解: 我以为是LCA的题,但dfs居然也能过,感觉是数据有 阅读全文
摘要:
RMQ模板 c++ include include include include include include include include include include using namespace std; define INF 0x3f3f3f3f define ll long lo 阅读全文
摘要:
分组背包(至少选一个) 我真的搞不懂为什么,所以现在就只能当作是模板来用吧 如果有大牛看见 希望评论告诉我 &代码: c++ include include include include include include include include include include using n 阅读全文
摘要:
Treap仿set 模板 蓝书232 &代码: c++ include include include include include include include include include include using namespace std; define INF 0x3f3f3f3f 阅读全文
摘要:
线段树(区间更改,区间查最值)模板 主要重在理解线段树,理解了怎么改都可以,还有以后不要直接抄模板,要写出自己想的一份代码 &代码: c++ include include include include include include include include include include 阅读全文