## 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.
ymondelo20
Posts: 1968
Joined: 9 years ago
Location: Universidad de las Ciencias Informáticas
Gender:
Contact:

### 1771 - Getting Home

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

Phantom
Posts: 58
Joined: 9 years ago
Location: Cuba
Gender:

### Re: 1771 - Getting Home

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:

### Re: 1771 - Getting Home

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..

Phantom
Posts: 58
Joined: 9 years ago
Location: Cuba
Gender:

### Re: 1771 - Getting Home

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??

ymondelo20
Posts: 1968
Joined: 9 years ago
Location: Universidad de las Ciencias Informáticas
Gender:
Contact:

### Re: 1771 - Getting Home

The main idea is correctly
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.