Compressed algorithm asked in icpc 2017

hello coders, Here is a problem from last year’s acm icpc online round COMPEXP.
this is having very high constraints and does not have any editorial till yet.
can you explain me the simple way to solve it ?
Thanks!

 does not have any editorial till yet.

Search forums.