Submit | All submissions | Best solutions | Back to list |
Problem hidden on 2011-09-16 11:24:20 by [Trichromatic] XilinX
DRIRA - Driving Range |
These days, many car makers are developing cars that run on electricity instead of gasoline. The batteries used in these cars are generally very heavy and expensive, so designers must make important tradeoffs when determining the battery capacity, and therefore the range, of these vehicles. Your task is to help determine the minimum range necessary so that it is possible for the car to travel between any two cities on the continent.
The road network on the continent consists of cities connected by bidirectional roads of different lengths. Each city contains a charging station. Along a route between two cities, the car may pass through any number of cities, but the distance between each pair of consecutive cities along the route must be no longer than the range of the car. What is the minimum range of the car so that there is a route satisfying this constraint between every pair of cities on the continent?
Input:
The input consists of a sequence of road networks. The first line of each road network contains two positive integers n and m, the number of cities and roads. Each of these integers is no larger than one million. The cities are numbered from 0 to n-1. The first line is followed by m more lines, each describing a road. Each such line contains three non-negative integers. The first two integers are the numbers of the two cities connected by the road. The third integer is the length of the road. The last road network is followed by a line containing two zeros, indicating the end of the input.
Output:
For each road network, output a line containing one integer, the minimum range of the car that enables it to drive from every city to every other city. If it is not possible to drive from some city to some other city regardless of the range of the car, instead output a line containing the word IMPOSSIBLE.
Example Input:
3 3
0 1 3
1 2 4
2 1 5
2 0
0 0
Example Output:
4
IMPOSSIBLE
Added by: | Andres Tellez |
Date: | 2011-08-23 |
Time limit: | 0.100s |
Source limit: | 50000B |
Memory limit: | 1536MB |
Cluster: | Cube (Intel G860) |
Languages: | All except: ASM64 |
hide comments
2012-07-14 16:47:29 Babazka
Zero byte Python solution still passes. Please fix the test. |
|
2011-09-29 20:54:01 blashyrkh
Accepted brainf**k solution?! Aliens among us! Colonization has begun! |
|
2011-09-16 09:23:39 [Trichromatic] XilinX
OK, seems like an empty output file. Problem will be hidden till it's fixed. |
|
2011-09-15 19:45:47 Luke Pebody
This seems like a good code golf candidate. I have an accepted zero byte solution in Python. |
|
2011-09-02 21:50:25 Alex Anderson
Reiterating what Oleg has said, there is no input file. Fix this. Last edit: 2011-09-02 21:50:37 |
|
2011-08-28 12:56:06 Michael T
Tests seem to be really weak. Not just in terms of N. |
|
2011-08-26 07:44:32 :D
There's something wrong with the input, there doesn't seem to be "0 0" there. Please correct the data and rejudge. |
|
2011-08-24 19:43:01 [ !0 ]
What does "The road network on the continent consists of cities connected by bidirectional roads of different lengths. " mean.. Can we have something like this : 1 0 10 1 0 20 0 1 15 1 0 65 if yes how can we determine what is the maxm possible number of routes between any pair of cities. |
|
2011-08-24 19:07:32 Oleg
Passed with assert (N <= 100); Please review test cases. |