
LCA
文章平均质量分 84
蘑菇小哲
在通往梦想的道路上奋力潜行
展开
-
POJ 1330 (LCA的在线算法,转RMQ用ST算法)
#include #include #include #include #include #include #include #include #include #include #define LL long longusing namespace std;#include#include#include#include#includeusing namespa原创 2015-02-25 13:45:08 · 695 阅读 · 0 评论 -
HDU 2874 Connections between cities(LCA + RMQ)
Connections between citiesTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 7295 Accepted Submission(s): 1856Problem Description原创 2015-10-21 13:23:56 · 396 阅读 · 0 评论 -
HDU 2586 How far away ?(water problem LCA)
How far away ?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9683 Accepted Submission(s): 3411Problem DescriptionThere are n原创 2015-10-21 12:17:01 · 455 阅读 · 0 评论 -
LCA o(nlogn)
#include #include #include #include #include #include #include #include #include #define LL long long using namespace std;int read(){ int x = 0, f = 1; char ch = getchar(); while(c原创 2015-10-05 09:51:05 · 456 阅读 · 0 评论 -
BZOJ 1787: [Ahoi2008]Meet 紧急集合(LCA)
1787: [Ahoi2008]Meet 紧急集合Time Limit: 20 Sec Memory Limit: 162 MBSubmit: 1693 Solved: 777[Submit][Status][Discuss]DescriptionInputOutputSample Input6 41 2 2 3 2原创 2015-09-30 11:55:44 · 446 阅读 · 0 评论 -
BZOJ 3991: [SDOI2015]寻宝游戏
3991: [SDOI2015]寻宝游戏Time Limit: 40 Sec Memory Limit: 128 MBSubmit: 471 Solved: 229[Submit][Status][Discuss]Description 小B最近正在玩一个寻宝游戏,这个游戏的地图中有N个村庄和N-1条道路,并且任何两个村庄之间有且仅有一条路径可达。游戏开始时,玩家可以任原创 2015-09-30 14:36:35 · 605 阅读 · 0 评论 -
CODE[VS] 1036 商务旅行(LCA + BFS)
题目描述 Description某首都城市的商人要经常到各城镇去做生意,他们按自己的路线去做,目的是为了更好的节约时间。假设有N个城镇,首都编号为1,商人从首都出发,其他各城镇之间都有道路连接,任意两个城镇之间如果有直连道路,在他们之间行驶需要花费单位时间。该国公路网络发达,从首都出发能到达任意一个城镇,并且公路网络不会存在环。你的任务是帮助该商人计算一下他的最短旅行时间。原创 2015-04-29 16:48:49 · 1201 阅读 · 0 评论 -
HDU 4547 CD操作(LCA + BFS)
Description: 在Windows下我们可以通过cmd运行DOS的部分功能,其中CD是一条很有意思的命令,通过CD操作,我们可以改变当前目录。 这里我们简化一下问题,假设只有一个根目录,CD操作也只有两种方式: 1. CD 当前目录名\...\目标目录名 (中间可以包含若干目录,保证目标目录通过绝对路径可达) 2. CD .. (返回当前目录的上级目录)原创 2015-02-25 16:31:58 · 743 阅读 · 0 评论 -
POJ 1330 Nearest Common ancesters(LCA,Tarjan离线算法)
Description:In the figure, each node is labeled with an integer from {1, 2,...,16}. Node 8 is the root of the tree. Node x is an ancestor of node y if node x is in the path between the root and node原创 2015-02-25 12:53:02 · 726 阅读 · 0 评论 -
POJ 1470 Closest Common Ancestors(LCA入门题)
#include#include#include#include#include#includeusing namespace std;const int MAXN=1000;//树中结点的数目const int MAXM= 500000;int F[MAXN];//并查集int r[MAXN];//并查集中集合的个数bool vis[MAXN];//访问标记int an原创 2015-02-25 14:40:21 · 450 阅读 · 0 评论 -
HDU 3830 Checkers(LCA)
CheckersTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 125536/65536 K (Java/Others)Total Submission(s): 875 Accepted Submission(s): 250Problem DescriptionLittle X, Little Y原创 2015-10-22 12:49:31 · 558 阅读 · 0 评论