I made the O(N) solution and it takes about 0.05s on quite old ntb.
If I remove the detection of repetition, then it took about 27s. It is
O(R+N) solution.


On May 9, 2:23 am, Abdelrhman Abotaleb <profvip.abota...@gmail.com>
wrote:
> mmm you may note that the queue of the groups is repeated after N times
> where N is the number of the groups
> So if R>N
> you will only calculate the earning from N rounds
> and multiply this earn by R[i]/N[i]
>
> if R[i]%N[i] is a value
> so make a loop over a rounds number =R[i]%N[i]
> and add the earning from it to the first earning
> that's all
>
> I make the solution and the output is so fast with me [about 10 seconds]
> but the contest was over :d
>
>
>
>
>
> On Sun, May 9, 2010 at 2:03 AM, sanjay sinha <sanjaysur...@gmail.com> wrote:
> > Hey i have also used only one loop for R (Number of rounds in one day)
> > but got some values of R about100000000 and looping through this takes
> > a lot of time...
> > This was the only one which i failed to submitt.
> > @Filpe can you paste a sudo code
>
> > Thanks
>
> > On Sun, May 9, 2010 at 5:11 AM, Felipe Sodré Silva <fso...@gmail.com>
> > wrote:
> > > My solution has only one loop with R cycles for each input, and it solved
> > > the large input in less than a minute. The problem is probably what you
> > are
> > > doing inside the loop. There's no way to solve it in time if you just do
> > > a straightforward simulation on each cycle.
> > > Malkava
>
> > > On Sat, May 8, 2010 at 3:12 PM, goutham <goutham...@gmail.com> wrote:
>
> > >> well I got the prob with Theme Park... the small inputs were solving
> > >> good but the large inputs contained loops for 100,000,000 which are
> > >> huge and time consuming .... and all my 8 min of submission time went
> > >> away...
>
> > >> is anyone else facing the same problem.
>
> > >> --
> > >> You received this message because you are subscribed to the Google
> > Groups
> > >> "google-codejam" group.
> > >> To post to this group, send email to google-c...@googlegroups.com.
> > >> To unsubscribe from this group, send email to
> > >> google-code+unsubscr...@googlegroups.com<google-code%2bunsubscr...@googlegr
> > >>  oups.com>
> > .
> > >> For more options, visit this group at
> > >>http://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 google-c...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-code+unsubscr...@googlegroups.com<google-code%2bunsubscr...@googlegr
> > >  oups.com>
> > .
> > > For more options, visit this group at
> > >http://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 google-c...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > google-code+unsubscr...@googlegroups.com<google-code%2bunsubscr...@googlegr 
> > oups.com>
> > .
> > For more options, visit this group at
> >http://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 google-c...@googlegroups.com.
> To unsubscribe from this group, send email to 
> google-code+unsubscr...@googlegroups.com.
> 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 google-c...@googlegroups.com.
To unsubscribe from this group, send email to 
google-code+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-code?hl=en.

Reply via email to