随笔分类 - 数据结构--LCA
摘要:xor There is a tree with nn nodes. For each node, there is an integer value a_iai, (1 \le a_i \le 1,000,000,0001≤ai≤1,000,000,000 for 1 \le i \l
阅读全文
摘要:Phone Call Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 156 Accepted Submission(s): 67 Probl
阅读全文
摘要:RXD, tree and sequence Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 524288/524288 K (Java/Others)Total Submission(s): 234 Accepted Submission(
阅读全文
摘要:Misha, Grisha and Underground time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Misha and
阅读全文
摘要:A and B and Lecture Rooms time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output A and B are pr
阅读全文
摘要:【题意】给你N个点,N条不同的边,Q次询问,求出u,v之间的最短路。 【分析】题意很简单,就是求最短路,但是Q次啊,暴力DIJ?当然不行,观察到这个题边的数目和点的数目是相同的,也就是说这个图是由一棵树加了一条边而形成的。而对于一棵树,如果有Q次询问最短路,那就可以用LCA来做,复杂度QlogN,但
阅读全文
摘要:COT - Count on a tree #tree #tree You are given a tree with N nodes.The tree nodes are numbered from 1 to N.Each node has an integer weight. We will a
阅读全文
摘要:Query on a tree II You are given a tree (an undirected acyclic connected graph) with N nodes, and edges numbered 1, 2, 3...N-1. Each edge has an integ
阅读全文
摘要:Distance Queries Time Limit: 2000MS Memory Limit: 30000K Total Submissions: 12950 Accepted: 4577 Case Time Limit: 1000MS Description Farmer John's cow
阅读全文