hi Mostafama
For Problem B, there are a number of inefficient and memory consuming
algorithms, and a few elegant ones.
If you use an elegant solution you will not have any memory problems.
here is my solution in python which does not consume any memory.
def count_func(inputdata):
(testcase, N, S, p, ti) = inputdata
count = 0
cutoff = 3*p-2
cutoff_surprising = 3*p-4
for total in ti:
if total >= cutoff:
count +=1
elif p>1 and total >= cutoff_surprising and S>0:
count += 1
S -= 1
return (testcase, count)
On Sun, Apr 15, 2012 at 3:09 AM, mostafamabrouk
<[email protected]> wrote:
> Hi
> While i was solving problem B in the qualification round for large input. i
> got out of memory exception - java heap space not sufficient.
> May anyone tell me what is the solution for such problem ?
> Thank you
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google Code Jam" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/google-code/-/n_NV7iDRit4J.
> 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.
--
You received this message because you are subscribed to the Google Groups
"Google Code Jam" 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.