n = int(input()) ids = input().split() splits = [0]*(n) counters = dict() for id in ids: if str(id) not in counters: counters[id] = 1 else: counters[id] += 1 max = max(counters.values()) splits[0] = n for i in range(n-1): if i+2 > max: break for city in counters: splits[i+1] += int(counters[city]/(i+2))*(i+2) print(' '.join(str(e) for e in splits))
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()) ids = input().split() splits = [0]*(n) counters = dict() for id in ids: if str(id) not in counters: counters[id] = 1 else: counters[id] += 1 max = max(counters.values()) splits[0] = n for i in range(n-1): if i+2 > max: break for city in counters: splits[i+1] += int(counters[city]/(i+2))*(i+2) print(' '.join(str(e) for e in splits)) |