orlon.'s blog

By orlon., history, 6 months ago, In English,

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.

 
 
 
 
  • Vote: I like it  
  • -1
  • Vote: I do not like it  

»
6 months ago, # |
  Vote: I like it +1 Vote: I do not like it

The problem lies in your handling of input. You assume that the first integer is the number of test cases. But is that really the case?

  • »
    »
    6 months ago, # ^ |
      Vote: I like it 0 Vote: I do not like it

    Corrected it, still the same segmentation fault. What's the problem now? :(

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by orlon. (previous revision, new revision, compare).

»
6 months ago, # |
  Vote: I like it 0 Vote: I do not like it

Auto comment: topic has been updated by orlon. (previous revision, new revision, compare).