CHFNFRN - Editorial

please provide some test cases.I tested my code with various inputs.But when i submit it shows wrong awnser for test case 1,4,7

@ktime can you tell me where my logic fails. i used same algorithm illustrated in Editorial

@ktime can you tell me where my logic fails. i used same algorithm illustrated in Editorial

@Antoniuk_Vasyl : n is not declared in your solution [Author’s solution]

What’s wrong with this solution?
link text

Checking the bipartiteness using dfs.

Thanks.

Showing wrong ans for test cases 1,4,7 what are the test cases?

@atulyaanand and @right_brained and @monikadaryani, I also used the same approach and it took me hours to find out the problem. Here is an example-
consider 6 friends with the relations as follows- 1-2, 1-5, 1-6, 2-3, 2-4, 3-4, 5-6
If you go on according to your algo you will find out that when you do it for friend number 5, it can not be placed in any group and hence results “NO”. But the solution is possible which is - table one- 1,5,6 and table two - 2,3,4. At first glance this algo seems to be correct solution but the thing is this is not even a solution, because it just simply does not meant to do what problem asks.

Hi All, in @author’s solution he used dfs on Graph G, it supposed to be on H i.e the complement of G can any one please explain why ?

Hello, can anyone point out the mistake in my approach, It only fails the first test case (with wrong answer) -

  1. If friends = 1 or 2, YES
  2. else if relations = 0, NO
  3. else if, for every friend-
  4. make an array “x” of people do not know him (have no relations with that particular friend)
  5. All the people in array “x” must know each other, If not, break, NO
  6. If loop ends naturally for all the friends in a test case, YES

In short - If there are any “Three” not related friends then the seating on two tables is not possible.

Hello Can someone explain what a clique is?

Nice problem and very good editorial. Learned lot’s of new things.