CODESPTB I’ve solved this problem using brute force, since time limit is high it passes, I read someone’s comment stating it can be solved with policy based Data structure.

So, what is policy based DS and how can this be applied to this problem?

I’m came across a codeforces blog but couldn’t understand it.

PS:I googled didn’t find a solution using policy based DS.