Codeforces problem D div 2 using BST

problem link- can someone help me to understand the tutorial… it uses the concept of BST??? thanks for help tutorial link problem D

I was also stuck in this problem and could not understand the tutorial. if you are trying for long time now then you can see the solution of neal_wu here. this solution is very clear and you’ll understand the idea.