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


GSS1- segment tree problem from SPOJ. Can't remove SIGSEGV, help needed.

The problem is GSS1 and my solution is very close to AC but I just can't seem to find why my code gives SIGSEGV segmentation fault on G4G IDE. Please take a quick look at the code and let me know, it will be a big help! Thanks a lot!

asked 17 Mar '18, 01:03

orlon's gravatar image

accept rate: 0%

Indeed quite a few blunders in your code:


int t = 1;
cin >> t;

I don't think any explanation required here.

2.Don't initialize result node values with LONG_MIN in query function as they will overflow if a -ve no. will be added to result.

AC Code


answered 17 Mar '18, 08:32

divik544's gravatar image

accept rate: 10%


Thank you so much! It takes great courage to go through someone else's lousy code and find the mistake, and people who do it are my type of heroes. The world needs more people like you, Divik. :)

(17 Mar '18, 15:28) orlon4★
toggle preview

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: 17 Mar '18, 01:03

question was seen: 321 times

last updated: 17 Mar '18, 15:28