You are not logged in. Please login at to post your questions!


[closed] SIGSEGV in COOK42 - ABCSTR

I've employed the same method described in the editorial just the implementation is a bit different. For each index calculate the no. of A's, B's, and C's till that index. Then calculate A[i]-B[i], B[i]-C[i] for each index. Store them in a structure. Sort them out. If there are X continuous pairs for which these are equal, add C(x,2) to the final count. I am getting SIGSEGV and am not able to spot out the error. Any help would be appreciated.

Link for the code : link text

asked 24 Mar '14, 00:22

eh2arch's gravatar image

accept rate: 0%

closed 24 Mar '14, 00:42

admin's gravatar image

0★admin ♦♦

The question has been closed for the following reason "Duplicate Question" by admin 24 Mar '14, 00:42

you should declare the structure variable (pp) as global with max size (1000000).On declaring the variable memory is given at runtime from stack which is not enough so SIGSEGV comes. On the other hand global declarations have static memory which is enough w.r.t to the test cases.


answered 24 Mar '14, 00:31

qwerty1's gravatar image

accept rate: 75%

edited 24 Mar '14, 00:35

Yes, made a very stupid mistake. Submitted. AC. Thanks a lot :D

(24 Mar '14, 00:37) eh2arch3★

We would request you to post the queries on the editorial page. Closing the question.


answered 24 Mar '14, 00:42

admin's gravatar image

0★admin ♦♦
accept rate: 35%

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here



Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text]( "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported
  • mathemetical formulas in Latex between $ symbol

Question tags:


question asked: 24 Mar '14, 00:22

question was seen: 668 times

last updated: 24 Mar '14, 00:42