首页 > TAG信息列表 > towns

【IOI2015】Towns

一个简单的想法是先用 \(2n - 3\) 次求直径 \(A, B\) 是 \(D\),每次距离最远的点。然后中心一定在直径上。 然后由于度数 \(> 3\) ,可以找到每个叶子在这条链上的相应位置( \(i\) 所在到直径最近的点),就用 \(a_i = (d_{i, A} +d_{i,b} - D) / 2\) 可以得到的距离,然后 \(d_{i, A} - a_i

【IOI2015】Towns

题目意思不说了。 考虑求半径显然先求直径,使用 \(2n-2\) 次询问直接找出答案。 然后考虑我们对于每一个点,其实他与直径上的距离你是可以计算出来的。 怎么算,通过列方程组的方法。 假设直径两端点为 \(x, y\) ,点 \(i\) 到直径的距离为为 \(d\) ,然后设往这个点到直径上的点对应点 \(

Educational Codeforces Round 98 (Rated for Div. 2) D. Radio Towers

Educational Codeforces Round 98 (Rated for Div. 2) D. Radio Towers 题目链接 There are n+2 towns located on a coordinate line, numbered from 0 to n+1. The i-th town is located at the point i. You build a radio tower in each of the towns 1,2,…,n with pro

[POI2008] CLO

zz:http://hzwer.com/3010.htmlByteotia城市有n个 towns m条双向roads. 每条 road 连接 两个不同的 towns ,没有重复的road. 你要把其中一些road变成单向边使得:每个town都有且只有一个入度Input第一行输入n m.1 <= n<= 100000,1 <= m <= 200000 下面M行用于描述M条边.OutputTAK或

poj1751kruskal

Highways Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 26772   Accepted: 7803   Special Judge Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. T

poj2485kruskal

Highways Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 40303   Accepted: 17615 Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has no public highways. So the traffic is difficult in Flato

POJ - Highways(最小生成树)

题目链接:http://poj.org/problem?id=1751Time Limit: 1000MS Memory Limit: 10000K Special Judge Description The island nation of Flatopia is perfectly flat. Unfortunately, Flatopia has a very poor system of public highways. The Flatopian government is aw

Directed Roads CodeForces - 711D (基环外向树 )

ZS the Coder and Chris the Baboon has explored Udayland for quite some time. They realize that it consists of n towns numbered from 1 to n. There are n directed roads in the Udayland. i-th of them goes from town i to some other town ai (ai ≠ i). ZS the Co

寒假特训——I - Fair

Some company is going to hold a fair in Byteland. There are nn towns in Byteland and mm two-way roads between towns. Of course, you can reach any town from any other town using roads. There are kk types of goods produced in Byteland and every town produce