I did something simpler than they proposed, but it solved the large problem in seconds, so I score it as "good enough". :-)
Since the groups have to board in order, for each group you can calculate how many people will ride, and which group will be first the next time. So I built an N x 2 array, and filled in those two values for each group. After that it's a simple process: 1: Pull up group 0's info. 2: Add # riders you get when group 0 is front of the line. 3: Find out which group will be at the beginning of the line for the next ride. 4: If there's another ride to be done, go to 1, using the new group's info. Greg On May 9, 8:33 am, Pakku <[email protected]> wrote: > Guys, > > I am wondering what all optimization we can really do. > Though, in the qualification, for the theme park problem, i could not > solve the large input problem in the given time frame, i optimized it > latter in the practice mode. > > These are the optimization that I did. > > for each test case, > > 1. if capacity of roller coaster >= total strength [ sum of all groups > ] then simply total earnings = total strength * number of rides. > 2. detect if can get a rep if yes, then > TotalEarnings = ( EarningsForRep * (RidesPerDay / TripsNeededToGetARep ) ); > and then TotalEarnings += earnings for the TripsStillLeftInADay ; > > Apart from these 2 optimization is there any other place we can > optimize. what is the best possible optimized solution. > anyone willing to share the best solution. > > -Prakash > > -- > You received this message because you are subscribed to the Google Groups > "google-codejam" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group > athttp://groups.google.com/group/google-code?hl=en. -- You received this message because you are subscribed to the Google Groups "google-codejam" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/google-code?hl=en.
