Блог пользователя code_tourist

Автор code_tourist, история, 9 лет назад, По-английски

In a party N people are invited. Some person can engage with some other person in party. You are given a matrix of 'Y' and 'N' . If the (i,j) is 'Y' then person i can engage with person j throughout the day and if (i,j) is 'N' then person i cannot engage with person j throughout the day. You have to find maximum number of people engaged in party.

Note : if a person is engaged with other person then he is engaged
whole day. he can't switch in between.

Ex.

N=4
N Y N N
Y N Y Y 
N Y N N
N Y N N  
Ans is = 2 because 2 nd person can engaged with one other person only  (2,1)
or (2,3) or (2,4)

Please help me with some ideas for this question .

  • Проголосовать: нравится
  • -3
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

This is a direct application of the maximum matching in a general graph. An algorithm to solve it is the blossom algorithm.