Hi shubham,

Make sure you clear your container after finishing every test case.
That should solve the problem.

Cheers

On May 13, 10:16 am, Andres Lara M <[email protected]> wrote:
> Thanks ulzha for the explanation.
> This is the first year I'm participating so there are many things I still
> don't know.
>
> I'm learning a lot in this group!
>
> My regards.
> Andrés
>
> 2011/5/13 ulzha <[email protected]>
>
>
>
> > No need for long long. 10^6 fits in an int and the sum of 1000 of
> > those does as well, and anyway an overflow doesn't incur segmentation
> > fault.
>
> > shubham, you should show your code. Otherwise my only guess is what
> > Axel Freyn said - maybe you use too much memory overall; clean up
> > after processing each case if needed.
>
> > ulzha
>
> > On May 12, 10:47 pm, Andres Lara M <[email protected]> wrote:
> > > Try to use vector<unsigned long long> instead of vector<int>. It's beause
> > > the limits are 1<=Ci<= 10^6
>
> > > 2011/5/12 Axel Freyn <[email protected]>
>
> > > > On Thu, May 12, 2011 at 2:20 PM, shubham <[email protected]> wrote:
>
> > > >> Hi there,
> > > >> when I executed the Candy-Splitting problem for the large dataset
> > > >> during the contest, i got segmentation fault.
> > > >> After enquiring i found out that the fault occured during the input. I
> > > >> had used vector<int> for the input. Why did
> > > >> push_back() function generated the segmentation fault?
>
> > > >> any guesses??
>
> > > > I think the problem is somewhere else. std::vector performs full memory
> > > > management in push_back, so a segfault should not happen here.
> > > > I only could imagine the segfault when you're out of memory -- then
> > > > push_back will fail to allocate the new memory and depending on your
> > > > implementation/compiler/operation system a segfault might happen:
> > > > (normally a exception should be thrown, but maybe your
> > C++implementation
> > > > does not check here? Or if you use e.g. the overcommit-feature of Linux
> > > > (allows the Kernel to allocate more memory than is physically
> > available), a
> > > > segfault can appear when you use this memory...)
>
> > > > You could try to call reserve() befor reading the file -- then the
> > memory
> > > > allocation is done at the beginning...
>
> > > > Axel
>
> > > >  --
> > > > 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.
>
> > --
> > 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.

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

Reply via email to