You are not logged in. Please login at www.codechef.com 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

4★orlon
404
accept rate: 0%


Indeed quite a few blunders in your code:

1.

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

link

answered 17 Mar '18, 08:32

divik544's gravatar image

4★divik544
5251110
accept rate: 10%

1

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
Preview

Follow this question

By Email:

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

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "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:

×2,738
×1,768
×1,137
×280
×21

question asked: 17 Mar '18, 01:03

question was seen: 321 times

last updated: 17 Mar '18, 15:28