Distributed Task Assignment Based on Gossip with Guaranteed Performance on Heterogeneous Networks