CRUCE - Crossing the bridge
n people wish to cross a bridge at night. A group of at most two people may cross at any time, and each group must have a flashlight. Only one flashlight is available among the n people, so some sort of shuttle arrangement must be arranged in order to return the flashlight so that more people may cross.
Each person has a different crossing speed; the speed of a group is determined by the speed of the slower member. Your job is to determine a strategy that gets all n people across the bridge in the minimum time.
The input begins with a single positive integer on a line by itself indicating the number of the cases following, each of them as described below. This line is followed by a blank line, and there is also a blank line between two consecutive inputs.
The line of input contains n, followed by n lines giving the crossing times for each of the people. There are not more than 1000 people and nobody takes more than 100 seconds to cross the bridge.
For each test case, the output must follow the description below. The outputs of two consecutive cases will be separated by a blank line.
The line of output must contain the total number of seconds required for all n people to cross the bridge.
This problem is hidden. That means there are some issues with it, like corrupt test data or bad judge. Please choose another problem to solve. If you'll navigate through problems lists or user solved lists you should only get valid problems. If not sure, alway check the title part of the description.
Always get SIGABRT, don't know why...
* deletedLast edit: 2010-06-20 13:07:01
Please Check The Test Case
Coach UTN FRSF, check my last submission - its only read data and print 0 and still generates SIGABRT - maybe N < 0 or too large for some case.
Check your test case please, I've got Accepted @ UVa.