<---------------------Editorial Solution start-------------------->
If there are multiple people with the same set of skills (i.e., the same values of a), it's optimal to take each of them to the camp as they won't think they're better than everyone else.
Now consider a person i which has a different set of skills than everyone else.
If they have a strictly smaller set of skills than someone already in the group, they can safely be included in the group. If they don't, we can prove that they can't ever be included in the group. This allows us to implement a simple O(n2) solution: first take all people that have an equal set of skills as someone else, and then include everyone else who has a strictly smaller set of skills than someone already in the group.
<---------------------Editorial Solution end-------------------->
Here, let n=6 , and denoting students as A,B,C,D,E,F
a values : A,B: 01100111 , C,D : 00110100 , E: 10100011, F: 10010100
b values : anything
Now according to the editorial, we will take A,B,C,D first as they occur multiple times. But we won't take E or F because they are not "smaller" than those already present in the group(their most significant bit is set).
But I think we can take all of them without any problem as E and F have the most significant bit in common.
I don't see how all together they will not satisfy the given condition..
From what i understand of Editorial, the meaning of " $$$A$$$ is a smaller set of $$$B$$$" is that $$$A$$$ is a submask of $$$B$$$ and $$$A \neq B$$$.
Let's analise when $$$A$$$ thinks that he is not better then $$$B$$$, for the condition that $$$A$$$ don't think he is better then $$$B$$$, its necessary that for every i where $$$A_{i} = 1$$$, then $$$B_{i} = 1$$$(because if we have some $$$A_{i} = 1$$$ and $$$B_{i} = 0$$$, that means A thinks he is better then B), that condition is the same thing to say that $$$A$$$ is a submask of $$$B$$$ ($$$A|B = B$$$).
So for some $$$A$$$, that is different from everyone , to be add in the group, need to have a element $$$B$$$ in the group that $$$A$$$ is a submask of $$$B$$$, if not, $$$A$$$ will think he is better then anyone in the group.
A,B: 01100111 , C,D : 00110100 , E: 10100011, F: 10010100
Here, E will think hes better than everyone else if he is added to the group of A,B,C,D.
But if we add F along with E, then neither E nor F will think that they're better than everyone else in the group
E will think he is better than F, because E know the algorithm represented by the least significant bit and F doesn't know, so E know a algorithm which F doesn't know, and that is the definition to E think he is better than F, same logic is valid to F thinks he is better than E with the third bit.
" A group of students can work together calmly if no student in this group thinks that he is better than everyone else in this group."
Shouldn't this be : " A group of students can work together calmly if no student in this group thinks that he is better than at least one other in this group."
No, i just pointed that E thinks he is better than F, and for analyze the most significant bit, you can see that E thinks he is better than A,B,C and D, so E think he is better then everyone in the whole input (the same logic for F), so E and F can't be add in any group.
Understood. Thanks