Getting SIGSEGV in treap

sigsegv
treap

#1

I am trying to solve https://www.codechef.com/problems/CHEFDTRE. This is my first attempt at treap and I chose this problem as it seemed simple for beginner. But I am getting SIGSEGV in all cases. It runs fine on my computer. I am unable to find my mistake. Please help.

My code : https://www.codechef.com/viewsolution/8566926

I am following e-maxx.ru for the concept.


#2

I found the problem. I needed to update size of subtree at a lot of places. I don’t know why, but I am sure I can figure it out on my own :slight_smile: