Problem Description The ALPC company is now working on his own network system, which is connecting all N ALPC department. To economize on spending, the backbone network has only one router for each department, and N-1 optical fiber in total to connec…
题意: 知道了一颗有 n 个节点的树和树上每条边的权值,对应两种操作: 0 x 输出 当前节点到 x节点的最短距离,并移动到 x 节点位置 1 x val 把第 x 条边的权值改为 val 题意: 知道了一颗有 n 个节点的树和树上每条边的权值,对应两种操作: 0 x 输出 当前节点到 x节点的最短距离,并移动到 x 节点位置 1 x val 把第 x 条边的权值改为 val LCA +RMQ+树状数组 #include <cstdio> #includ…
题目链接: 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,之后我们可以把经过的所有点找出来,之后排个序就好了,…
Network Time Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/65536K (Java/Other) Total Submission(s) : 24 Accepted Submission(s) : 5 Problem Description The ALPC company is now working on his own network system, which is connecting all N AL…