I was trying to solve this algorithmic problem and I came across this nice solution:
"The idea is to treat the ai, bi and ci asymmetrically. The BIT supports minimum queries for key intervals starting at 1. We use ci as values and bi as keys. Those are inserted in the order of increasing ai. This way, for each ai in turn, the data structure allows queries for the smallest value of cj (possibly ∞) for bj in [1..bi) and aj < ai. We have cj < ci if and only if contestant i is not excellent."
Now I am having hard time understanding this solution.
Here's what I understand of this solution: I know that binary indexed tree is used to answers queries like finding sum of an interval in an array and it also support updates in elements. It does both the operations in O(logn) time complexity each. Now this solution says that we build BIT with keys as ci, and value as bi, that is basically bi is an additional value that goes with each node. Now we insert elements in the tree with increasing values of ai, this is where I lost the grip. How does it matter in what order we are inserting nodes and what the statement says following that part, I have no idea.
Please help me understand what this solution says.