import math n = int(input()) line = input() arr = line.split(" ") el_c = {} for el in set(arr): el_c[el] = arr.count(el) res = [] for i in range(1, n + 1): count = 0 for key in el_c: count += el_c[key] // i res.append(count * i) print(" ".join(str(v) for v in res))
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | import math n = int(input()) line = input() arr = line.split(" ") el_c = {} for el in set(arr): el_c[el] = arr.count(el) res = [] for i in range(1, n + 1): count = 0 for key in el_c: count += el_c[key] // i res.append(count * i) print(" ".join(str(v) for v in res)) |