Why not just fix the computer?

Techno is a large island country with exactly 101 cities. The country is extremely advanced when it comes to technology, and, as a result, they have assigned a quantum supercomputer in order to manage all of the construction and management in the country.

The supercomputer, though, encountered a glitch. One day, when it was asked to connect all of the cities in the country using roads, it encountered an error which caused it to build a road between a random pair of cities, only stopping when all of the cities have been connected. In the worst case scenario, how many roads will the country have to build such that any two cities are connected?

Note : If you can find a path from city A to city B (possibly passing through other cities) then city A and city B are connected.


The answer is 4951.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

2 solutions

Manuel Kahayon
Aug 29, 2016

The maximum number of roads is achieved when 100 100 cities are connected in such a way that any two cities are connected by a road, then the 101 101 st city is connected to any of the 100 100 cities, resulting in ( 100 2 ) + 1 = 4951 {100 \choose 2} + 1 = 4951 roads.

We then prove that 4951 4951 roads will always connect all of the cities. Assume that there are two groups of connected cities which are not connected to each other. Let the first group have x x cities. The second group will then have 101 x 101-x cities. The first group has at most ( x 2 ) = ( x ) ( x 1 ) 2 {x \choose 2} = \frac{(x)(x-1)}{2} roads. Similarly, the second group has at most ( 101 x 2 ) = ( 101 x ) ( 100 x ) 2 {101-x \choose 2} = \frac{(101-x)(100-x)}{2} roads. All in all, the two groups will have ( x ) ( x 1 ) 2 + ( 101 x ) ( 100 x ) 2 = x 2 101 x + 5050 \frac{(x)(x-1)}{2} + \frac{(101-x)(100-x)}{2} = x^2 - 101x + 5050 roads.

Now, this is a quadratic which is maximised when 50.5 x |50.5 - x| is maximised. Since we cannot have x = 101 x = 101 or x = 0 x=0 (Since this will connect all of the cities), we can either have x = 1 x = 1 or x = 100 x = 100 . This sets the total number of roads for which the country is not connected to be 4950 4950 at maximum. Therefore adding one road will connect the country, so our answer is 4951 \boxed{4951} .

Seriously, lvl 5?

Wen Z - 4 years, 9 months ago

Log in to reply

It's level 4 now. I don't have any idea how the rating systems work around here sometimes :p

Manuel Kahayon - 4 years, 9 months ago
Zee Ell
Aug 29, 2016

In the worst case scenario, 100 cities will be connected in all possible ways and the last city (the 101st) will be connected directly by one of them (and indirectly, by all other cities).

Therefore, the maximum number of roads is:

100 × 99 2 + 1 = 4951 \frac {100 × 99}{2} + 1 = \boxed {4951}

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...