Civilization 题目链接: http://acm.hust.edu.cn/vjudge/contest/121334#problem/B Description Andrew plays a game called "Civilization". Dima helps him. The game has n cities and m bidirectional roads. The cities are numbered from 1 to n. Between any pa…
好久没有写过图论的东西了,居然双向边要开两倍空间都忘了,不过数组越界cf居然给我报MLE??这个题题意特别纠结,一开始一直不懂添加的边长是多长... 题意:给你一些点,然后给一些边,注意没有重边 环,接着给你两种操作: 1 x :求出 x 的集合中最长的边权值 2 x y:合并 x 的集合和 y的集合变成一个集合,并且将 x 集合中任意一个点与 y 集合中任意一个点相连,使合成的集合的任意两个点的最大权值最小,其中两个点相连的权值为1 开始边是固定的,因而建图并两次dfs遍历找树直径,但是不一定…
题目链接 C. Civilization time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Andrew plays a game called "Civilization". Dima helps him. The game has n cities and m bidirectional roads. The cit…