Python Forum

Full Version: Greedy algorithms on logical problems
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello fellow python programmers,

I have the following problem:

I have got k gifts and k people. Every gift is denoted by [1..k] and every person as well.
Every person has 3 wishes [x, y , z] which all correspond to one gift. Every person will get a gift and every gift is unique. How do I accomplish, that I achieve these goals:
1st Maximum of people should get their first wish
2nd Maximum of people should get their second wish --> Optimization after the first step which is more important
3rd Maximum of people should get their third wish, if their first and second wish wasn't fullfilled.

I've thought about a greedy algorithm, but I'm lost