摘要: 题面:https://www.luogu.org/problem/P3398 cpp 本题有个很好的方法:显然当lca(a,b)在c,d路径上出现过,或者lca(c,d)在a,b路径上出现过,那么这两条路径一定重合. (注:一个点在路径上当且仅当这个点到这条路径两端点距离和等于这条路径长度.) Co 阅读全文
posted @ 2019-10-11 21:14 prestige 阅读(113) 评论(0) 推荐(0) 编辑
摘要: ```cpp 题面:https://www.luogu.org/problem/P1379 本题直接双向bfs,那么双向bfs就是把初始状态和终止状态都放进队列里,然后将二者设定为不同的方向,同时跑bfs,若目的状态和当前状态相同,目的状态无需再次入队,若目的状态和当前状态方向相反,那么直接输出答案 阅读全文
posted @ 2019-10-11 20:14 prestige 阅读(139) 评论(0) 推荐(0) 编辑
摘要: ```cpp include include include include include include include include using namespace std; const int N=51000005; char a[N]; int n,ans[N],anss,ma[N 2] 阅读全文
posted @ 2019-10-11 14:29 prestige 阅读(108) 评论(0) 推荐(0) 编辑