------
## 最终结论
```python
def largest_sum_of_subset(values, labels, num_wanted, use_limit):
    items = list(zip(values, labels))
    sorted_items = sorted(items, key=lambda x: x[0], reverse=True)

    label_count = {}
    total_value = 0
    items_selected = 0

    for value, label in sorted_items:
        if items_selected < num_wanted:
            if label not in label_count:
                label_count[label] = 0

            if label_count[label] < use_limit:
                total_value += value
                label_count[label] += 1
                items_selected += 1

    return total_value

# Example usage:
values1 = [5,4,3,2,1]
labels1 = [1,1,2,2,3]
num_wanted1 = 3
use_limit1 = 1
print(largest_sum_of_subset(values1, labels1, num_wanted1, use_limit1)) # Output: 9

values2 = [5,4,3,2,1]
labels2 = [1,3,3,3,2]
num_wanted2 = 3
use_limit2 = 2
print(largest_sum_of_subset(values2, labels2, num_wanted2, use_limit2)) # Output: 12

values3 = [9,8,8,7,6]
labels3 = [0,0,0,1,1]
num_wanted3 = 3
use_limit3 = 1
print(largest_sum_of_subset(values3, labels3,num_wanted3,use_limit3)) # Output: 16

values4 = [9,8,8,7,6]
labels4 = [0,0,0,1,1]
num_wanted4 = 3
use_limit4 = 2
print(largest_sum_of_subset(values4 ,labels4 ,num_wanted4,use_limit4)) # Output: 24
```