Ideal infinity for segment tree

Revision en1, by dush1729, 2020-02-17 22:08:31

Hi,

I was solving CYCLCSUM from recent Codechef Cook Off. I used segment tree to solve the problem. I got accepted when I set negative infinity as -1e15 and wrong answer when it is -1e18. I am probably getting wrong answer due to overflow.

So my question what should be the value of infinity in segment tree to avoid overflow?

Tags #segment tree

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English dush1729 2020-02-17 22:08:31 509 Initial revision (published)