n = int(input()) a = list(map(int,input().split())) cnt = dict() cnt2 = [] for i in a: if i in cnt:cnt[i] += 1 else:cnt[i] = 1 for i in cnt.values():cnt2.append(i) cnt2.sort() s = 0 res = [] for i in range(1, n + 1): ith = 0 for j in range(s, len(cnt2)): v = cnt2[j] // i * i ith += v if v == 0:s += 1 res.append(ith) print(" ".join(str(i) for i in res))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 | n = int(input()) a = list(map(int,input().split())) cnt = dict() cnt2 = [] for i in a: if i in cnt:cnt[i] += 1 else:cnt[i] = 1 for i in cnt.values():cnt2.append(i) cnt2.sort() s = 0 res = [] for i in range(1, n + 1): ith = 0 for j in range(s, len(cnt2)): v = cnt2[j] // i * i ith += v if v == 0:s += 1 res.append(ith) print(" ".join(str(i) for i in res)) |