Editorial for Bubble Cup V9 F Pokermon League challenge


Remember to use this editorial only when stuck, and not to copy-paste code from it. Please be respectful to the problem author and editorialist.
Submitting an official solution before solving the problem yourself is a bannable offence.

The key idea is to first put players into conferences and then assign them to teams. We go through all of the players and put them into conferences so that the first condition is satisfied. We take them one by one and select a conference for each player such that he hates more (or equally many) players in the other conference than the one we put him in. That means that at any point of this process, there will be more hate edges connecting players in different conferences than those connecting players in the same conferences. Thus, in the end, we have satisfied the first condition. Complexity is \mathcal O(N+E) for this part.

Now we will try to satisfy the second condition by assigning teams to the players. Let S be the set of all of the teams that appear on at least one wish list. Let's select some subset A of S. We select it in a way that every element from S will be thrown in it with 50\% chance. Now, we will assign teams from A to players in conference 1 and teams from A^c to players in conference 2. If such assigning is possible while satisfying the second condition, we will be done. Let's see what is the chance that a particular player in conference 1 can't be assigned a valid team from A. That means none of at least 16 teams on his wish list are in A. The chance for that is \frac{1}{2^{16}}. Same goes for all players in conference 1 and equivalently for conference 2. So, the chance that at least one player can't be assigned a team is at most \frac{N}{2^{16}} \le 0.763. This means that there is at least 23.7\% chance that this method will give us the final solution which fulfills both problem conditions. This means that after several steps, we will very likely solve the problem. Complexity is \mathcal O(NL) for this part. For example, if we do 30 steps, the probability that we will find a correct solution is 1-0.763^{30} \ge 0.9997.


Comments

There are no comments at the moment.