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.

Reply via email to