mercredi 28 février 2018

Need help in calculating minimum pair

I have a problem like this:-

enter image description here

Description of the problem:- There are M no. of boys and N no. of girls. The boy B1 can match only with that girl who has minimum number of fights with. All boys have fought with all the girls. One boy can match up with one girl only based on minimum number of fights as mentioned before. For example:- if Boy B1 is matched up with girl G2 then no other boy can match up with girl G2 and vice versa. The input will be in matrix form like this:-

std::vector<std::vector<float>> input = {
  {1.0f,0.03f,1.0f},
  {0.04f,1.0f,0.2f},
  {0.05f,0.01f,0.03f},
  {1.0f,0.05f,0.01f}
}; // I know the fight value is in float, but please take this for granted

Output should be the pair containing row and column like this:-

[1,0],[2,1],[3,2]

I need the algorithm to calculate this type of problem. Thank you.

Aucun commentaire:

Enregistrer un commentaire