![](https://img-blog.csdnimg.cn/20201014180756919.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
最近公共祖先
everlasting__
'-'
展开
-
bzoj 3364: [Usaco2004 Feb]Distance Queries 距离咨询 LCA
→题目链接←【想说的话】TLE了3遍后我深刻的认识到了....跑最短路果然不可行...【题解】显然是裸的LCA【代码】#include#include#include#include using namespace std;struct node{ int to,len; node(int x,int y){to=x,len=原创 2017-10-12 11:22:49 · 275 阅读 · 0 评论 -
bzoj 3251: 树上三角形 暴力
→题目链接←【想说的话】啊啊啊啊,搬完博客的第一篇博客md新博客调了一天,头都大了【题解】想一想,可以发现如果答案为no,在int范围内最多只可能同时存在46个数所以找到lca,判断下路径上的点的个数,如果大于46个就输出Yes,否则暴力判断【代码】#include#define MAXN 100010typedef long lon原创 2017-12-12 20:33:24 · 273 阅读 · 0 评论