ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1254. Die Hard

A USEFUL HINT for those TLE authors!!!
Posted by 198808xc 1 Sep 2008 12:31
Many people got TLE on this problem.
However, there are ways to avoid TLE.
I viewed some topics before, and they told me to use vectors instead of float numbers.
I tried, but it doesn't work for my bad programming.

After that, I tried to think another way...

Many people got TLE, but they only use 7 or 8 sec.
Here is a method to make the time derive to half:

First, find all avaliable task, and assume the staring point is No.0
then, instead of calculating all the shortest paths,
we can calculate this:
Shortest from No.1 to No.0 and No.2, (add them up)
Shortest from No.3 to No.2 and No.4, (add them up)
......
thus we can easily save half of the time,
and My program got AC in 2.8 sec (previously TLE)

Sorry for my bad English.
Good luck for EVERYONE~