
LCA
morejarphone
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
NEU 1690 (最短路+LCA)
1690: Terrorists 时间限制: 5 Sec 内存限制: 128 MB 提交: 11 解决: 3 [提交][状态][讨论版] 题目描述 Terrorists! There are terrorists everywhere!!! I was shouting out loud after I had watched a few news reports abou原创 2016-03-23 17:43:35 · 547 阅读 · 0 评论 -
SPOJ COT (主席树 LCA)
题目链接:点击打开链接 题意:求树上u-v之间路径上的第k小的节点值. 和数列的第k小类似不过写起来烦一点.在数列上求区间第k小是两个前缀减一减, 树上就是u-root,v-root前缀加一加减去两倍LCA-root,新建线段树都是在父亲节 点的基础上更新的. #include #include #include #include #include #include #inc原创 2016-06-06 13:48:05 · 520 阅读 · 0 评论 -
NEUOJ 720 (字典树+LCA || 二分+哈希)
题目链接:点击这里Problem: 头哥的烦恼Time limit: 5s Mem limit: 1000 MB AC/Submission: 16/94 Discuss Problem Description 头哥,众所周知,作为acm队的主力选手,最近遇到了一些烦恼,那就是CET-4临近了,但是他还有很多单词没记住.现在头哥有n个单词没记住,(所有的单词长度加起来不超过原创 2016-06-15 10:27:53 · 437 阅读 · 0 评论 -
HDU 4912 (贪心)
题目链接:点击这里题意:在一棵树上给出m个链<u,v><u,v>, 求出最多能够选择多少个链使得所有的链都没有交点。根据lca自底向上贪心即可。#include <cstring> #include <iostream> #include <cstdio> #include <cmath> #include <algorithm>using namespace std; #define maxn 1原创 2016-07-07 22:54:03 · 454 阅读 · 0 评论 -
codeforces 519E (LCA)
题目链接:点击这里题意:给出一个树,q个询问,每次询问给出两个点#include <bits/stdc++.h> #define Clear(x,y) memset (x,y,sizeof(x)) #define FOR(a,b,c) for (int a = b; a <= c; a++) #define REP(a,b,c) for (int a = b; a >= c; a--) #defin原创 2016-11-07 20:56:06 · 556 阅读 · 0 评论