def group_scores(scores): d = {} for score in scores: d.setdefault(score, 0) d[score] += 1 return d n = int(input()) a = list(map(int, input().split())) values = list(group_scores(a).values()) values.sort(reverse=True) res = [] for i in range(1, n+1): c = 0 for v in values: if i > v: break c += int(v/i) * i res.append(c) print(" ".join(map(str, res)))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | def group_scores(scores): d = {} for score in scores: d.setdefault(score, 0) d[score] += 1 return d n = int(input()) a = list(map(int, input().split())) values = list(group_scores(a).values()) values.sort(reverse=True) res = [] for i in range(1, n+1): c = 0 for v in values: if i > v: break c += int(v/i) * i res.append(c) print(" ".join(map(str, res))) |