When the greedy algorithm fails