题目链接: Network Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Problem Description The ALPC company is now working on his own network system, which is connecting all N ALPC department. To economize on spending, t…
Network [题目链接]Network [题目类型]LCA dfs &题意: 给出n个点的权值,m条边,2种操作 0 u num,将第u个点的权值改成num k u v,询问u到v这条路上第k大的权值点 &题解: 首先可以确定的是这是一颗树,求的又是路径,所以我们可以试着用lca辅助一下(有人说为什么不用最短路,当然可以用最短路,但是时间复杂度很高,还有树上u到v点只有1条路,所以不必用最短路) 所以可以先求一下输入的u和v的lca,之后我们可以把经过的所有点找出来,之后排个序就好了,…
题目链接:pid=5289">http://acm.hdu.edu.cn/showproblem.php?pid=5289 题面: Assignment Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others) Total Submission(s): 672 Accepted Submission(s): 335 Problem Description Tom owns a…
题目大意:给出n个点的权值.m条边,2种操作 0 u num,将第u个点的权值改成num k u v,询问u到v这条路上第k大的权值点 解题思路:该点的话直接该,找第k大的话直接暴力 #include <cstdio> #include <cstring> #include <algorithm> using namespace std; #define N 80010 #define M 160010 struct Edge{ int to, next, val; }…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=3183 Problem DescriptionKiki likes traveling. One day she finds a magic lamp, unfortunately the genie in the lamp is not so kind. Kiki must answer a question, and then the genie will realize one of her d…