Problem:


Score : 600 points

Problem Statement

Takahashi has N cards. The i-th of these cards has an integer A_i written on it.

Takahashi will choose an integer K, and then repeat the following operation some number of times:

Choose exactly K cards such that the integers written on them are all different, and eat those cards. (The eaten cards disappear.)

For each K = 1,2, \ldots, N, find the maximum number of times Takahashi can do the operation.

Constraints

 1 \le N \le 3 \times 10^5 

 1 \le A_i \le N 

All values in input are integers.

Input

Input is given from Standard Input in the following format:

N
A_1 A_2 \ldots A_N

Output

Print N integers.
The t-th (1 \le t \le N) of them should be the answer for the case K=t.

Sample Input 1

3
2 1 2

Sample Output 1

3
1
0

For K = 1, we can do the operation as follows:

Choose the first card to eat.

Choose the second card to eat.

Choose the third card to eat.

For K = 2, we can do the operation as follows:

Choose the first and second cards to eat.

For K = 3, we cannot do the operation at all. Note that we cannot choose the first and third cards at the same time.

Sample Input 2

5
1 2 3 4 5

Sample Output 2

5
2
1
1
1

Sample Input 3

4
1 3 3 3

Sample Output 3

4
1
0
0



Sample input:
3
2 1 2


Sample output:
3
1
0

Submission status: Wrong Answer

Solution code:
import collections
from heapq import *
from bisect import *

N=int(input())
A=list(map(int,input().split()))
c=collections.Counter(A)
l=list(c.values())
h=[]
for i in range(len(l)):
    heappush(h,l[i])
h2=[]
for i in range(len(l)):
    heappush(h2,heappop(h))
s=sum(h2)
m=[0]*(N+1)
for i in range(N):
    br=bisect_right(h2,s//(i+1))
    if m[br] != 0:
        sbr = m[br]
    else:
        sbr=sum(h2[:br])
        m[br]=sbr
    print(sbr//(i+1-(len(l)-br)))

Submission status: Wrong Answer

Solution code:
from collections import Counter
from itertools import accumulate
from bisect import bisect_right
N = int(input())
As = list(map(int, input().split()))
ct = Counter(As)
ctm = [c[1] for c in ct.most_common()]
ctm.reverse()
L = len(ctm)
acc = [0] +  list(accumulate(ctm))

arr = [0]
for n in range(1, N+1):
  idx = bisect_right(ctm, n)
  arr.append(acc[idx] + n*(L-idx))

for i in range(1, N+1):
  f = 1
  t = N // i + 1
  if f +1 >= t:
    print(0)
    continue
  while f + 1 < t:
    m = f + (t-f) // 2
    if arr[m] >= m*i:
      f = m
    else:
      t = m
  print(f)

Submission status: Wrong Answer

Solution code:
import collections


def zeros(num):
    for _ in range(num):
        print(0)
        
def main():
    N=int(input())
    A=[int(x) for x in input().split()]
    Adic=collections.Counter(A)
    kinds=len(Adic.keys())

    val=list(Adic.values())
    val.sort(key=lambda x:-x)
    vlst=[]
    mx=0
    
    for i in range(1,N+1):
        if i>kinds:
            zeros(N-i+1)
            return
        if i==1:
            print(N)
            continue

        if val[0]-val[1]<N%i:
            tmp=(val[0]+val[1]+1)//2
        else:
            tmp=val[0]-N%i
        
        if tmp>N//i:
            print(N//i-((val[0]-N%i)-N//i))
            
        else:
            print(N//i)
main()

Submission status: Wrong Answer

Solution code:
#"""
import sys
input = sys.stdin.readline
#"""

N = int(input())
*A, = map(int,input().split())

import heapq

B = {}
for a in A:
    B[a] = B.get(a,0)+1

B= sorted([-b for b in B.values()])
heapq.heapify(B)
M = len(B)
B2 = B[:]

def check(B2,k,tmp):
    if ans[k]!=None : return
    B = B2[:]
    while True:
        C = [-heapq.heappop(B) for _ in [0]*k]
        m = -B[0]
        cnt = min((C[-1]-m)+1,C[-1])
        for c in C:
            heapq.heappush(B,-(c-cnt))
        tmp += cnt
        if cnt==0 : break
    ans[k] = tmp
    for n in range(2,int(k**0.5+1)):
        if k%n == 0:
            check(B,k//n,tmp*n)

ans = [None]*(N+1)
for k in range(M+1,N+1):
    ans[k] = 0
ans[M] = -max(B)
ans[1] = N
for k in range(M-1,0,-1):
    check(B,k,0)

for out in ans[1:]:
    print(out)

Submission status: Wrong Answer

Solution code:
import collections
from copy import deepcopy

N = int(input())
A = [int(a) for a in input().split()]
A_dic = collections.Counter(A)
for k in range(1, N+1):
    if k == 1:
        print(N)
    elif k < len(A_dic.keys()):
        dic = deepcopy(A_dic)
        ans = 0
        while len(dic.keys()) >= k:
            for i, key in enumerate(dic.keys()):
                if i >= k:
                    ans += 1
                    break
                dic[key] -= 1
            new_dic = {k:v for k,v in dic.items() if dic[k] > 0}
            dic = new_dic
        print(ans)
    elif k == len(A_dic.keys()):
        print(min(A_dic.values()))
    elif k > len(A_dic.keys()):
        print(0)

Submission status: Wrong Answer

Solution code:
# -*- coding: utf-8 -*-
# abc143/abc143_f
import sys

s2nn = lambda s: [int(c) for c in s.split(' ')]
ss2nn = lambda ss: [int(s) for s in list(ss)]
ss2nnn = lambda ss: [s2nn(s) for s in list(ss)]
i2s = lambda: sys.stdin.readline().rstrip()
i2n = lambda: int(i2s())
i2nn = lambda: s2nn(i2s())
ii2ss = lambda n: [i2s() for _ in range(n)]
ii2nn = lambda n: ss2nn(ii2ss(n))
ii2nnn = lambda n: ss2nnn(ii2ss(n))

def main():
    N = i2n()
    A = i2nn()
    s = set(A)
    print(N)
    for i in range(2, N+1):
        print(len(s) // i)
    return

main()

Submission status: Wrong Answer

Solution code:
N = int(input())
a = list(map(int, input().split()))

s = len(set(a))

from collections import Counter

lst = []
A = Counter(a)
for i in A:
    lst.append(A[i])
lst.sort()

def calc(n):
    tmp = N // n
    b = 0
    c = tmp
    for i in lst:
        if i <= n:
            pass
        else:
            if b == i:
                pass
            else:
                tmp -= max(0, i - c)
                if tmp <= 0:
                    return 0
    return tmp
            
for i in range(1, N + 1):
    if i > s:
        print (0)
        continue
    print (calc(i))

Submission status: Wrong Answer

Solution code:
#F問題
N = int(input())
A = list(map(int,input().split()))
A.sort()
B = [0 for i in range(N)]
for a in A:
    B[a-1]+=1
B.sort(reverse=True)
bcount = 0
for i in range(N):
    print(min(N-bcount,N//(i+1)))
    b = B[i]
    bcount+=b

Submission status: Wrong Answer

Solution code:
import collections
import heapq
n=int(input())
A=[int(i) for i in input().split()]
AA=sorted(collections.Counter(A).values())
m=len(AA)
heapq.heapify(AA)
Ans=[0]*n
Ans[0]=n
for i in range(m-1):
  a=heapq.heappop(AA)
  Ans[m-1-i]=a
  b=heapq.heappop(AA)
  heapq.heappush(AA,a+b)
for i in range(n):
  print(Ans[i])

Submission status: Wrong Answer

Solution code:
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	A = getlist()
	D = defaultdict(int)
	for i in A:
		D[i] += 1
	a = []
	for i in D:
		a.append(D[i])
	a = sorted(a)
	n = len(a)
	S = sum(a)
	for i in range(n - 1):
		a[i + 1] += a[i]

	for i in range(1, N + 1):
		if i > n:
			print(0)
		else:
			print(min((S // i), a[-i]))



if __name__ == '__main__':
	main()

Submission status: Wrong Answer

Solution code:
from collections import Counter as C
from itertools import accumulate as ac
from bisect import bisect_left as bl
n=int(input())
a=C(list(map(int,input().split())))
t=sorted(a.values())
s=list(ac(t))
s=s+[s[-1]]
d={}
for i in range(1,n+1):
    if i==1:
        print(n)
    elif i<=len(t):
        if n//i+1 not in d:
            d[n//i+1]=bl(t,n//i+1)
        c=s[-1]-s[d[n//i+1]-1]-(n//i)*(max(0,len(t)-d[n//i+1]))
        print((n-c)//i)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
a=set(a)
l=len(a)
for k in range(1,n+1):
    if k==1:
        print(n)
    else:
        t=l//k
        print(t)

Submission status: Wrong Answer

Solution code:
import bisect

N = int(input())

B = list(map(int,input().split()))

dic = {}

for i in B:

    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1

A = []
for i in dic:
    A.append(dic[i])

A.sort()
AS = sum(A)
#print (A)

for i in range(N):

    i += 1

    print (AS // i)

    

    ind = bisect.bisect_right(A,i)
    AS -= max( 0, len(A) - ind )
    #print (ind,i,AS)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import heapq

n = int(input())
A = list(map(int,input().split()))

A = Counter(A)


ans = []

heap = []
for v in A.values():
    heap += [v]
heapq.heapify(heap)

for i in range(n):
    x = heapq.heappop(heap)
    ans += [x]
    if not heap:
        break
    y = heapq.heappop(heap)
    heapq.heappush(heap,x+y)


ans2 = list(reversed(ans))+[0]*(n-len(ans))

for a in ans2:
    print(a)

Submission status: Wrong Answer

Solution code:
import sys
stdin = sys.stdin

sys.setrecursionlimit(10 ** 7)

def li(): return map(int, stdin.readline().split())
def li_(): return map(lambda x: int(x) - 1, stdin.readline().split())
def lf(): return map(float, stdin.readline().split())
def ls(): return stdin.readline().split()
def ns(): return stdin.readline().rstrip()
def lc(): return list(ns())
def ni(): return int(stdin.readline())
def nf(): return float(stdin.readline())

from collections import Counter

def binsearch(n: int, k: int, nexs: list):
    left = 0
    right = n // k + 1
    while right - left > 1:
        mid = (left + right) // 2
        if nexs[mid * k - 1] < k:
            right = mid
        else:
            left = mid

    return left


n = ni()
a = list(li())

# 並び替え
b = []
cnt = 0
numlist = Counter(a)
while cnt < n:
    newnumlist = {}
    keys = sorted(list(numlist.keys()))
    for key in keys:
        val = numlist[key]
        b.append(key)
        cnt += 1
        if val > 1:
            newnumlist[key] = val - 1

    numlist = newnumlist

# i番目の数について、次に同じものが出るまでの最小距離
INF = float("inf")
temp = [INF]*(n+1)
nexs = [INF]*(2*n)

for idx in range(n):
    if temp[b[idx]] != INF:
        nexs[idx] = idx - temp[b[idx]]
    temp[b[idx]] = idx

for i in range(1,len(nexs)):
    nexs[i] = min(nexs[i-1], nexs[i])


# kの倍数かつ次に同じものが出るまでの距離がk以上である最大の数を求める
for k in range(1, n + 1):
    if k == 1:
        print(n)
    else:
        print(binsearch(n, k, nexs))

Submission status: Wrong Answer

Solution code:
import collections


def zeros(num):
    for _ in range(num):
        print(0)
        
def main():
    N=int(input())
    A=[int(x) for x in input().split()]
    Adic=collections.Counter(A)
    kinds=len(Adic.keys())

    val=list(Adic.values())
    val.sort(key=lambda x:-x)
    vlst=[]
    mx=0
    
    for i in range(1,N+1):
        if i>kinds:
            zeros(N-i+1)
            return
        if i==1:
            print(N)
            continue

        
        if val[0]-N%i>N//i:
            print(N//i-((val[0]-N%i)-N//i))
            
        else:
            print(N//i)
main()

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
t=0
a.sort()
a=set(a)
l=len(a)
s=1
for k in range(1,n+1):
    if k==1:
        print(n)
    else:
        t=l//k
        print(t)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))

from collections import Counter

C=Counter(A)

LIST=sorted(C.values())
LEN=len(LIST)
SUM=sum(LIST)
BASE=[]
BASESUM=0

MAX=LIST[-1]

for k in range(1,N+1):
    if k>LEN:
        print(0)
    else:
        BASE.append(LIST[-k])
        #print(BASE)

        BASESUM+=LIST[-k]

        REST=SUM-BASESUM
        REST0=REST

        MIN=LIST[-k]
        #MAX=LIST[-1]

        if MAX*k-BASESUM<=REST:
            print(SUM//k)
            continue

        while MIN!=MAX:
            mid=(MIN+MAX+1)//2
            REST=REST0

            for b in BASE[::-1]:
                if b<mid:
                    REST-=mid-b
                if REST<0 or b>=mid:
                    break

            #print(MAX,MIN,mid,REST)

            if REST>=0:
                MIN=mid
            else:
                MAX=mid-1

        print(MIN)

Submission status: Wrong Answer

Solution code:
def solve():
    N = int(input())
    A = [int(a) for a in input().split()]
    nA = len(set(A))
    ans = [0] * N
    ans[0] = N
    for i in range(1, nA):
        ans[i] = N // (i + 1)

    for a in ans: print(a)
    return 0

if __name__ == "__main__":
    solve()

Submission status: Wrong Answer

Solution code:
import collections


def zeros(num):
    for _ in range(num):
        print(0)
        
def main():
    N=int(input())
    A=[int(x) for x in input().split()]
    Adic=collections.Counter(A)
    kinds=len(Adic.keys())

    val=list(Adic.values())
    val.sort(key=lambda x:-x)
    print(val)

    vlst=[]
    mx=0
    
    for i in range(1,N+1):
        if i>kinds:
            zeros(N-i+1)
            return
        if i==1:
            print(N)
            continue

        
        if val[0]-N%i>N//i:
            print(N//i-((val[0]-N%i)-N//i))
            
        else:
            print(N//i)
main()

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
dic=[0]*(N+1)
for x in range(N):
	dic[A[x]]+=1
dic.sort(reverse=True)
#print(dic)
def w(N,K):
	ans=N//K
	if N%K!=0:ans+=1
	return ans

for K in range(1,N+1):
	muda=0
	for x in dic:
		if x>w(N,K):
			muda+=x-w(N,K)
		else:
			break
	print((N-muda)//K)

Submission status: Wrong Answer

Solution code:
# F
# -*- coding: utf-8 -*-
N = int(input())
A_list = list(map(int, input().split()))

A_set = set(A_list)
A_dup_list = []
for iter_a in A_set:
    counter = A_list.count(iter_a)
    if counter > 1:
        A_dup_list.append(counter)

A_dup_list.sort(reverse=True)
A_len = len(A_list)
A_dup_len = len(A_dup_list)

print(A_len) # K = 1
for i in range(2, N + 1):
    if i > A_dup_len:
        dup_end = A_dup_len
    else:
        dup_end = i - 1
    
    sum_dup = sum(A_dup_list[:dup_end])
    if sum_dup > (A_len - sum_dup) // i:
        ans = (A_len - sum_dup) // (i - 1)
    else:
        ans = A_len // i
    print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter as C
from itertools import accumulate as ac
from bisect import bisect_left as bl
n=int(input())
a=C(list(map(int,input().split())))
t=sorted(a.values())
s=list(ac(t))
s=s+[s[-1]]
d=["" for i in range(n+1)]
for i in range(1,n+1):
    if i==1:
        print(n)
    elif i<=len(t):
        if d[n//i+1]=="":
            d[n//i+1]=bl(t,n//i+1)
        c=s[-1]-s[d[n//i+1]-1]-(n//i)*(max(0,len(t)-d[n//i+1]))
        print((n-c)//i)
    else:
        print(0)

Submission status: Wrong Answer

Solution code:
import collections
from heapq import *
from bisect import *

N=int(input())
A=list(map(int,input().split()))
c=collections.Counter(A)
l=list(c.values())
h=[]
for i in range(len(l)):
    heappush(h,l[i])
h2=[]
for i in range(len(l)):
    heappush(h2,heappop(h))
s=sum(h2)
for i in range(N):
    br=bisect_right(h2,s//(i+1))
    sbr=sum(h2[:br])
    print(sbr//(i+1-(len(l)-br)))

Submission status: Wrong Answer

Solution code:
import math
n = int(input())
lis = [0 for i in range(n)]
li = list(map(int,input().split()))
kaburi = 0
kaburikata = 0
for num in li:
  if lis[num-1] != 0:
    kaburi += 1
  lis[num-1] += 1
  kaburikata = max(kaburikata,lis[num-1])
lis.sort(reverse = True)
ans = 0

anslis = [math.floor(n/(i+1)) for i in range(n)]

for i in range(1,n):
  anslis[i] = min(anslis[i],math.floor((n-kaburikata)/(i)))
for i in range(kaburi):
  anslis[-(i+1)] = 0
for num in anslis:
  print(num)

Submission status: Wrong Answer

Solution code:
from collections import Counter
n = int(input())
c = Counter(map(int, input().split()))
a = sorted(list(c.values()))

for i in range(1, n+1):
    if i > len(a):
        print(0)
        continue
    s = sum(a[:len(a)-i+1])
    ans = s//i
    if s%i:
        ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
#F問題
N = int(input())
A = list(map(int,input().split()))
A.sort()
B = [0 for i in range(N)]
for a in A:
    B[a-1]+=1
B.sort(reverse=True)
bcount = 0
for i in range(N):
    if i == 0:
        print(N)
    else:
        b = B[i-1]
        bcount+=b
        print(min(N-bcount,N//(i+1)))

Submission status: Wrong Answer

Solution code:
import collections
n = int(input())
a = list(map(int,input().split()))


c = collections.Counter(a)
values, counts = zip(*c.most_common())

for i in range(1,n+1):
    ans = n//i
    over = [jj-ans for jj in counts if jj>ans]
    if over != []:
        ans = ans -(sum(over)+i-1)//i

    print(ans)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=[int(i) for i in input().split()]

import collections
d=collections.Counter(a).most_common()

num=[c[1] for c in d]
num.sort(reverse=True)
m=len(num)

print(n)
for k in range(2,n+1):
    if k>min(n//2+1, m):
        print(0)
    else:
        numq=num[:]
        mq=m
        ans=0
        while mq>=k:
            kaisu = numq[k-1]
    #        print(k,mq,kaisu,numq)
            subt = [kaisu if i<k else 0 for i in range(mq) ]
            numq = [numq[i]-subt[i] for i in range(mq)]
            numq.sort(reverse=True)
    #        print(numq)
            while numq[-1]==0 and len(numq)>1:
                del numq[-1]
            mq=len(numq)
            ans+=kaisu
        print(ans)

Submission status: Wrong Answer

Solution code:
from collections import Counter
import sys
input = sys.stdin.buffer.readline
sys.setrecursionlimit(10**7)
INF = 10**12

n = int(input())
a = [int(item) for item in input().split()]

cnt = Counter(a)
c = list(cnt.values()) + [0] * n
c.sort(reverse=True)
ccum = [0] * (len(c) + 1)
for i, item in enumerate(c):
    ccum[i+1] = ccum[i] + item

for i in range(n):
    if i == 0:
        print(n)
        continue
    target = ccum[n] - ccum[i]
    ans = min(target, a[i] // i)
    print(ans)

Submission status: Wrong Answer

Solution code:
import numpy as np 
def unique(l1): 
    x = np.array(l1) 
    return len(np.unique(x))
n=int(input())
l=list(map(int, input().split()))
ans=unique(l)
for i in range(1,n+1):
    if i==1:
        print(n)
    elif i>ans:
        print(0)
    else:
        print(ans//i)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline

N=int(input())
A=list(map(int,input().split()))

from collections import Counter

C=Counter(A)

LIST=sorted(C.values())
LEN=len(LIST)
SUM=sum(LIST)
BASE=[]
BASESUM=0
MAX=LIST[-1]

for k in range(1,N+1):
    if k>LEN:
        print(0)
    else:
        BASE.append(LIST[-k])
        #print(BASE)

        BASESUM+=LIST[-k]

        REST=SUM-BASESUM
        REST0=REST

        MIN=LIST[-k]

        if MAX*k-BASESUM<=REST:
            print(SUM//k)
            continue

        while MIN!=MAX:
            mid=(MIN+MAX+1)//2
            REST=REST0

            for b in BASE[::-1]:
                if b<mid:
                    REST-=mid-b
                if REST<0 or b>=mid:
                    break

            #print(MAX,MIN,mid,REST)

            if REST>=0:
                MIN=mid
            else:
                MAX=mid-1

        print(MIN)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
print(len(a))
set_a=set(a)
for i in range(n-1):
  print(len(set_a)//(i+2))

Submission status: Wrong Answer

Solution code:
import itertools

n = int(input())
l = [int(v) for v in input().split()]

l = sorted(l)

res = {}
comb = list(itertools.combinations(l, 3))
count = 0
for i in range(len(comb)):
    a = comb[i][0]
    b = comb[i][1]
    c = comb[i][2]
    if '{}{}{}'.format(a, b, c) in res:
        count += 1
        continue
    if a + b <= c:
        continue
    elif a + c <= b:
        continue
    elif b + c <= a:
        continue
    else:
        count += 1
        res['{}{}{}'.format(a, b, c)] = 'Good'

print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
dic=[0]*(N+1)
for x in range(N):
	dic[A[x]]+=1
dic.sort(reverse=True)
#print(dic)

for K in range(1,N+1):
	muda=0
	for x in dic:
		if x>(N//K):
			muda+=x-(N//K)
		else:
			break
	print((N-muda)//K)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
for i in range(len(a)):
  s=0
  if i==0:
    print(len(a))
  else:
    for j in range(0,len(a)+1,i+1):
      if len(a[i*j:j+i+1])==i+1 and len(a[i*j:j+i+1]) == len(list(set(a[i*j:j+i+1]))):
        s+=1
    print(s)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
dic=[0]*(N+1)
for x in range(N):
	dic[A[x]]+=1
dic.sort(reverse=True)
#print(dic)

for K in range(1,N+1):
	muda=0
	for x in dic:
		if x>(N//K):
			muda+=x-(N//K)
			break
	print((N-muda)//K)

Submission status: Wrong Answer

Solution code:
import copy
n = int(input())
lis = sorted(list(map(int, input().split())))

def eat(li, k):
  count = 0
  while True:
    se = set(li)
    if k<=len(se):
      for l in list(se)[:k]:
        li.remove(l)
      count += 1
    else:
      break
  return count

for k in range(1, n+1):
  li = copy.copy(lis)
  print(eat(li, k))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int,input().split()))
a_set = set(a)
b = len(a_set)
print(n)
for i in range(2,n+1):
    print(max(b//i,0))

Submission status: Wrong Answer

Solution code:
from collections import defaultdict
n=int(input())
a=list(map(int,input().split()))
d=defaultdict(int)
for i in range(n):
    d[a[i]]+=1
dd=sorted([d[x] for x in d])
#print(dd)
di={len(dd):dd[0]}
for i in range(1,len(dd)):
    if dd[i]==dd[i-1]:
        continue
    di[len(dd)-i]=dd[i]-dd[i-1]
#print(di)
for i in range(1,n+1):
    ans=0
    for x in di:
        ans+=x//i*di[x]
    print(ans)

Submission status: Wrong Answer

Solution code:

n = int(input())
a = [int(x) for x in input().split()]

d = {}

for x in a:
    d[x] = d.get(x,0) + 1

for k in range(1,n+1):
	if k > len(d):
		print(0)
	else:
		good = False
		c = d.copy()
		total = 0
		while True:
			count = 0
			found = False
			for key, val in c.items():
				if val > 0:
					c[key] = val - 1
					count += 1
					if count == k:
						total += 1
						found = True
				if found:
					break
			if not found:
				break
		print(total)

Submission status: Wrong Answer

Solution code:
class Node:
    def __init__(self, key):
        self.left = None
        self.right = None
        self.val = key
def insert(root, node):
    if root is None:
        root = node
    else:
        if root.val < node.val and root.val != node.val:
            if root.right is None:
                root.right = node
            else:
                insert(root.right, node)
        elif root.val != node.val:
            if root.left is None:
                root.left = node
            else:
                insert(root.left, node)
def maxDepth(node):
    if node is None:
        return 0
    else:
        lDepth = maxDepth(node.left)
        rDepth = maxDepth(node.right)

        # Use the larger one
        if (lDepth > rDepth):
            return lDepth + 1
        else:
            return rDepth + 1


n = int(input())
l = list(map(int, input().split()))
r = Node(l[0])
for i in range(1,n):
    insert(r, Node(l[i]))
maxlen = maxDepth(r)

for i in range(1,n+1):
    if i ==1:
        print(n)
    else:
        print(maxlen//i)

Submission status: Wrong Answer

Solution code:
import collections
N = int(input())
list = list(map(int, input().split()))
list.sort()
c = collections.Counter(list)
len = len(c)

if N == 1:
    print(N)
else:
    print (N)
    for i in range (2, N + 1):
        p = len//i
        print(p)

Submission status: Wrong Answer

Solution code:
N = int(input())
d_list = list(map(int, input().split()))
print(N)
for i in range(N-1):#2の場合から考える。。。
    K = i + 2
    b = 0
    a = K - 1
    count = 0
    for j in range(N // K):
        if len(set(d_list[b:a+1])) == K:
            count += 1
        b += K
        a += K
    print(count)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
dic=[0]*(N+1)
for x in range(N):
	dic[A[x]]+=1
dic.sort(reverse=True)
print(dic)

for K in range(1,N+1):
	muda=0
	for x in dic:
		if x>(N//K):muda+=x-(N//K)
	print((N-muda)//K)

Submission status: Wrong Answer

Solution code:

N = int(input())

B = list(map(int,input().split()))

dic = {}

for i in B:

    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1

A = []
for i in dic:
    A.append(dic[i])

A.sort()
A_sub = A.copy()
A_sum = sum(A)


#print (A,A_sub)

for i in range(len(A)-1):

    A_sub[i+1] += A_sub[i]


for i in range(N):

    i += 1

    if i > len(A):
        print (0)

    else:
        
        ans = A_sum - ((A_sub[-1] - A_sub[-1 * i]) - A[-1*i] * (i-1) )

        print (ans // i)

Submission status: Wrong Answer

Solution code:
import collections
import heapq
import bisect
import math
import copy

N = int(input())
A = list(map(int, input().split()))
cnt = [0] * N
dist = 0
cnt.sort(reverse=True)
for a in A:
    if cnt[a-1] == 0:   dist += 1
    cnt[a-1] += 1
for K in range(1, 1+N):
    if K > dist:
        print(0)
    elif K >= N // 2 + 1:
        print(1)
    else:
        res = 0
        dp = copy.deepcopy(cnt)
        tmp = dist
        while tmp >= K:
            cur = 0
            idx, times = 0, 0
            while times < K:
                if dp[idx] > 0:
                    dp[idx] -= 1
                    times += 1
                    if dp[idx] == 0:    tmp -= 1
                idx += 1
            res += 1
        print(res)

Submission status: Wrong Answer

Solution code:
import collections
n=int(input())
a=collections.Counter(map(int,input().split()))
b=list(a.values())
b.sort()
c=len(b)
for i in range(1,n+1):
    if i>c:
        print(0)
    else:
        print(sum(b[:c-i+1:i]))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = [int(i) for i in input().split()]
b = {}
for i in a:
    if i in b:
        b[i] += 1
    else:
        b[i] = 1
c = [0]*n
for i in b:
    for j in range(b[i]):
        c[j] += 1


def solve(k,l=0, e=c[:]):
    ans = 0
    d = 0
    flag=0
    for i in range(l, n):
        if e[i] >= k and flag==0:
            l = i
            flag=1
        ans += (d + e[i]) // k
    print(ans)
    return l

l=0
for k in range(1, n+1):
    l=solve(k,l)

Submission status: Wrong Answer

Solution code:
def MAP(): return list(map(int,input().split()))
def INT(): return int(input())
def FLOAT(): return float(input())
MOD = 10**9+7

n = INT()
a = MAP()

m = len(set(a))
print(len(a))
for k in range(2,n+1):
    print(m//k)

Submission status: Wrong Answer

Solution code:
from heapq import heappush,heappop
n=int(input())
a=list(map(int,input().split()))
a.sort()
k=a[0]
data=[]
count=1
for i in range(1,n):
    if a[i]==k:
        count+=1
    else:
        k=a[i]
        heappush(data,count)
        count=1
heappush(data,count)
l=len(data)
lst=[0]*(n-l)
lst.append(data[0])
for i in range(1,l):
    x=heappop(data)
    y=heappop(data)
    heappush(data,x+y)
    lst.append(data[0])
for i in range(1,n+1):
    print(lst[-i])

Submission status: Wrong Answer

Solution code:


def main():
    N = int(input())
    A = map(int, input().split())
    s = len(set(A))
    for i in range(1, N+1):
        if i == 1:
            print(N)
        else:
            print(int(s / i))


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict,deque
import sys,heapq,bisect,math,itertools,string,queue,copy,time
sys.setrecursionlimit(10**8)
INF = float('inf')
mod = 10**9+7
eps = 10**-7
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))
def inpl_str(): return list(sys.stdin.readline().split())

N = inp()
AA = inpl()
cnts = defaultdict(int)
ed = set()
for a in AA:
    cnts[a] += 1
    ed.add(a)

aa1 = defaultdict(int)
for e in ed:
    aa1[cnts[e]] += 1

aa1 = sorted(list(aa1.items()))
aa2 = [0] # 種類数
aa3 = [0] # 実枚数
for t,n in aa1:
    aa2.append(aa2[-1] + n)
    aa3.append(aa3[-1] + n*t)

# print(aa1)
# print(aa2)
# print(aa3)

L = len(aa1)
tmpl_t = []
tmpl_c = []
for i,(t,n) in enumerate(aa1):
    tmp = n + aa3[i]//t
    tmp += aa2[-1] - aa2[i+1]
    tmpl_t.append(t)
    tmpl_c.append(tmp)
    # print(t,'回食べるとき，最大',tmp,'枚までいける')

tmpl_t.reverse()
tmpl_t.append(0)
tmpl_c.reverse()
ans = [0]*N
for i in range(1,N+1):
    idx = bisect.bisect_left(tmpl_c,i)
    if idx == 0:
        ans[i-1] = N//i
    else:
        ans[i-1] = tmpl_t[idx]

print('\n'.join(map(str,ans)))

Submission status: Wrong Answer

Solution code:
#input
N = int(input())
A = sorted(list(map(int, input().split())))

l = len(A)
lx = len(list(set(A)))
for k in range(1, N + 1):
    if k != 1 and lx != l:
        print(lx//k)
    else:
        print(l//k)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
k=[0]*(n+1)
for i in a:k[i-1]-=1
k.sort()
for ii in range(n):
  i=ii+1
  x=0
  for j in range(1,n//i+1):
    if k[j*i-1]==0:break
    else:x+=-k[j*i-1]
  print(x)

Submission status: Wrong Answer

Solution code:
N = int(input())
A = list(map(int, input().split()))
A_ = [0] * (N+1)
for a in A:
    A_[a] += 1
A_ = sorted(A_[1:])
Ans = []
n = N
for i, a in enumerate(A_[::-1], 1):
    Ans.append(min(N//i, n))
    n -= a

print("\n".join(map(str, Ans)))

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
mydict = {}
for i in a:
    try:mydict[i]+=1
    except:mydict.setdefault(i, 1)
l = len(mydict)
for i in range(1, n+1):
    if(i==1):print(n)
    else:print(int(l/i))

Submission status: Wrong Answer

Solution code:
import math
import itertools
import collections
N = int(input())
A = [int(_) for _ in input().split()]
c = sorted(collections.Counter(A).values())
acc = list(itertools.accumulate([0] + c))
n = len(acc) - 1
for i in range(1, n + 1):
    print(math.ceil(acc[n - i + 1] / i))
for _ in range(N - n):
    print(0)

Submission status: Wrong Answer

Solution code:
n=int(input())
a=list(map(int,input().split()))
a=list(set(a))
m=len(a)

print(n)
for i in range(2,n+1):
    y=m//i
    print(y)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = set([int(x) for x in input().split()])

for k in range(1,n+1):
	print(len(a)//k if k!=1 else n)

Submission status: Wrong Answer

Solution code:
import math

n=int(input())
alist = list(int(i) for i in input().split())
alist=sorted(alist)
blist=[]
before=-1
for i in range(n):
    if alist[i]==before:
        blist[-1]+=1
    else:
        blist.append(1)
    before=alist[i]

#print(blist)
blist=sorted(blist,reverse=True)
#print(blist)

nokori=n
for i in range(n):
    if i==0:
        print(n)
    else:
        if len(blist)<=i-1:
            print(0)
        else:
            nokori-=blist[i-1]
            print(min(nokori, math.floor(n/(i+1))))

Submission status: Wrong Answer

Solution code:

N = int(input())

B = list(map(int,input().split()))

dic = {}

for i in B:

    if i not in dic:
        dic[i] = 1
    else:
        dic[i] += 1

A = []
for i in dic:
    A.append(dic[i])

A_sub = A.copy()
A_sum = sum(A)
A.sort()

for i in range(len(A)-1):

    A_sub[i+1] += A_sub[i]


for i in range(N):

    i += 1

    if i > len(A):
        print (0)

    else:
        
        ans = A_sum - ((A_sub[-1] - A_sub[-1 * i]) - A[-1*i] * (i-1) )

        print (ans // i)

Submission status: Wrong Answer

Solution code:
n = int(input())
a = list(map(int, input().split()))
b = [0 for i in range(n + 1)]
ans = [0 for i in range(n + 1)]

for _a in a:
  b[_a] += 1

b.sort(reverse=True)

for i in range(1, n + 1):
  for j in range(i - 1, n, i):
    ans[i] += b[j]

for i in range(1, n + 1):
  print(ans[i])