Help Me in understanding this solution of FlipCoin.[Problem Code]

I’m new to CP and as of now practicing CodeChef medium problem. While solve the Problem FlipCoin I went to the past submission and found out this solution which I couldn’t able to understand.

  1. What programming technique he/she is using and why?
  2. What’s the benefit of using it over segment tree?
    and why there are so many pointers in there?
    Thanks for helping a beginner.