1771 - Getting Home

Discussion around the problems of the COJ.
Forum rules
Remember that posting AC code is not allowed here. If you are going to ask a question or to post a solution, describe your algorithm instead. Posting AC code will be penalized.
Post Reply
User avatar
ymondelo20
Posts: 1968
Joined: 8 years ago
Location: Universidad de las Ciencias Informáticas
Gender: None specified
Contact:

1771 - Getting Home

Post by ymondelo20 » 8 years ago



"Every problem has a simple, fast and wrong solution" OJ's Main Law. ;)

User avatar
Phantom
Posts: 58
Joined: 8 years ago
Location: Cuba
Gender: None specified

Re: 1771 - Getting Home

Post by Phantom » 8 years ago

May you can post a more ugly test case here?? Because my algorithm works for all my test cases, but the COJ dislike it... :(

george
Posts: 43
Joined: 9 years ago
Gender: None specified

Re: 1771 - Getting Home

Post by george » 8 years ago

Phantom wrote: my algorithm works for all my test cases, but the COJ dislike it... :(
Can you describe your algorithm?? so someone could understand what you are doing..

User avatar
Phantom
Posts: 58
Joined: 8 years ago
Location: Cuba
Gender: None specified

Re: 1771 - Getting Home

Post by Phantom » 8 years ago

My algorithm is very simple. I initialize the first and the last vertex whith value 0, because Stadium will always be at neighbourhood 1 and Mirko’s house will be at neighbourhood N in the map, and he won't need to pay anything on those two points. Afterward, I implement an algorithm that give me the shorted path since an origin(the first vertex in this case). Afterward, I print the value of the shorted path of the last vertex. Are something wrong??

User avatar
ymondelo20
Posts: 1968
Joined: 8 years ago
Location: Universidad de las Ciencias Informáticas
Gender: None specified
Contact:

Re: 1771 - Getting Home

Post by ymondelo20 » 8 years ago

The main idea is correctly :D
I think that you should see for the way that you find the shortest path, more especifically, the way in which you make the graph.
"Every problem has a simple, fast and wrong solution" OJ's Main Law. ;)

Post Reply

Return to “Problem set”