GSS1- segment tree problem from SPOJ. Quick help needed!

Правка en3, от orlon., 2018-03-17 13:02:30

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. I request you to take a quick look at the code and let me know, it will be a big help! Thanks a lot!

PS- I used segment tree to store sum, maximum prefix sum, maximum suffix sum and maximum subarray sum in a segment.

Edit:- Nevermind, I found the mistake. I was initialising a node with all four variable values as LLONG_MIN which should't have been done because adding a negative number to that will cause overflow. Also, in build function I forgot the start>end case.

Теги spoj, gss1, sigsegv, help needed, segment tree

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en3 Английский orlon. 2018-03-17 13:02:30 256
en2 Английский orlon. 2018-03-17 12:45:32 14 Tiny change: 'tebin.com/wAENHQTM) is very ' -> 'tebin.com/040iSBaN) is very '
en1 Английский orlon. 2018-03-16 22:40:15 491 Initial revision (published)