LCA
文章平均质量分 81
Kirigaya__Kazuto
这个作者很懒,什么都没留下…
展开
-
zoj 3195 Design the city
/* Design the city Time Limit: 1 Second Memory Limit: 32768 KB Cerror is the mayor of city HangZhou. As you may know, the traffic system of this city is so terrible, that there are traffic jams e原创 2017-07-11 10:17:10 · 262 阅读 · 0 评论 -
HDU 3078 Network tarjan算法
/* Network Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 1304 Accepted Submission(s): 581 Problem Description The ALPC company is now w原创 2017-07-11 14:34:55 · 190 阅读 · 0 评论 -
HDU 2586 How far away ?
题意 在一棵树上问你两点之间的距离 裸的LCA 这里我用了离线算法的Tarjan做的(今天刚学的GG,在线的算法暂时还没看) #include #include #include #include #include #include using namespace std; typedef long long LL; const int Tmaxn = 40000+10; con原创 2017-07-05 21:11:41 · 138 阅读 · 0 评论 -
HDU 2874 Connections between cities
第一、注意 head_tree[],head_query[]只需要开到节点的个数那么多就可以了,MLE了好几发才意识到的,尴尬 第二这个题目需要特判下这两个节点是不是在一棵树上 剩下的就是求LCA了 #include #include #include #include #include #include using namespace std; const int Tmaxn原创 2017-07-06 15:41:47 · 149 阅读 · 0 评论 -
POJ 1470 Closest Common Ancestors
一个裸的LCA,唯一的坑点就在于输入(╯‵□′)╯︵┻━┻,不得不GG #include #include #include #include #include #include using namespace std; typedef long long LL; const int INF = 0x3f3f3f3f; const int maxn = 1000; struct tr原创 2017-07-05 22:12:19 · 135 阅读 · 0 评论 -
POJ 1986 Distance Queries
Distance Queries Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 13849 Accepted: 4880 Case Time Limit: 1000MS Description Farmer John's cows refused t原创 2017-07-06 13:27:06 · 158 阅读 · 0 评论