#11749 - Poor Trade Advisor| Solved By: | wesley | | Theory Difficulty: | easy | | Coding Difficulty: | easy | | Algorithms Used: | other graph
| | Solution Description: | The only way to get the highest average PPA is by using only the roads that have the highest PPA.
So, ignore all edges that do not have the highest PPA. Then, do a floodfill on each vertex to find the largest connected component. Return the size of that component. Note that edges may have negative PPAs.
I wasn't able to make this run in time in Java. In pure C it took me 0.6s, so there's obviously a lot of input. |
Copyright 2008 (c) QuestToSolve.Com - Graphs Powered By
|