Say beauty pageants are judged based on 3 criteria: 1) Appearance 2) Personality 3) Talent. A contestant $C$ will beat another contestant $C'$ if she gets higher scores in ALL THREE of the criteria.
There are $n$ girls competing. Contestant $C_i$ is "Model Material" if $C_i$ is not beat by any other contestant $C_j$. Pretend you're the announcer and you have a collection of tuples: $(A_i, P_i, T_i)$ for $i = 1, 2,...,n$
The $i$th tuple contains the appearance, personality, and talent rating for $C_i$ (higher scores are better). Return a list of the "Model Material" contestants in in $O(n\log{n})$ time.
Given a data structure w/ a set $E$ of ints that, given an int $a$, --- (1) tells if a is in $E$ (2) finds smallest value > $a$ or largest value < $a$ in $E$ (3) inserts or removes a from $E$ in $O(\log{|E|})$ time.
I am trying to write pseudo-code for this algorithm but am lost trying to think of a correct algorithm that also runs in $O(n\log{n})$ time. I thought about starting initially with the $A_1$, $P_1$, and $T_1$ values for the first contestant, and if another contestant has a higher score in each category, remove the current tuple and replace it with the higher tuple, then repeat this process starting with a different contestant each time, but that's obviously not $O(n\log{n})$, and probably doesn't even work.
(This question was from my algorithms professor, and I can't find it online or in our textbook)