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 sys 
import collections as cl
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberList=[x[1] for x in NumberTupleList[::-1]]
LengthOfNumberList=len(NumberList)
FormulaList=[sum([min(NumberList[i],x)/x for i in range(LengthOfNumberList)]) for x in range(1,N+1)]

pin=N
for K in range(1,N+1):
    while pin>0 and K>FormulaList[pin-1]:
        pin-=1
    print(pin)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl
import numpy as np
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberList=np.array([x[1] for x in NumberTupleList[::-1]])
LengthOfNumberList=len(NumberList)
FormulaList=[sum([min(NumberList[i],x)/x for i in range(LengthOfNumberList)]) for x in range(1,N+1)]

pin=N
for K in range(1,N+1):
    while pin>0 and K>FormulaList[pin-1]:
        pin-=1
    print(pin)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl
import numpy as np
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberList=np.array([x[1] for x in NumberTupleList[::-1]])
LengthOfNumberList=len(NumberList)

FormulaList=[sum([min(NumberList[i],x)/x for i in range(LengthOfNumberList)]) for x in range(1,N+1)]


 
for K in range(1,N+1):
    pin=N
    while pin>0 and K>FormulaList[pin-1]:
        pin-=1
    print(pin)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl
import numpy as np
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberList=np.array([x[1] for x in NumberTupleList[::-1]])
LengthOfNumberList=len(NumberList)

FormulaList=[sum([min(NumberList[i],x)/x for i in range(LengthOfNumberList)]) for x in range(1,N+1)]


 
for K in range(1,N+1):
    pin=0
    while  pin<N and K<=FormulaList[pin]:
        pin+=1
    print(pin)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl
import numpy as np
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberList=np.array([x[1] for x in NumberTupleList])
LengthOfNumberList=len(NumberList)

for K in range(1,N+1):
    counter=0
    _NumberList=np.array([x for x in NumberList])
    for j in range(0,LengthOfNumberList-K+1):
        m=min(_NumberList[j:j+K])
        counter+=m
        _NumberList[j:j+K]-=m
    print(counter)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl
import numpy as np
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberList=np.array([x[1] for x in NumberTupleList[::-1]])
LengthOfNumberList=len(NumberList)

for i in range(1,N+1):
    counter=0
    _NumberList=np.array([x for x in NumberList])
    for j in range(0,LengthOfNumberList-i+1):
        m=_NumberList[j]
        counter+=m
        _NumberList[j:j+i]-=m
    print(counter)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl
import numpy as np
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberTupleList.sort(key=lambda x:x[1])
NumberList=np.array([x[1] for x in NumberTupleList])
LengthOfNumberList=len(NumberList)

for i in range(1,N+1):
    counter=0
    _NumberList=np.array([x for x in NumberList])
    for j in range(0,LengthOfNumberList-i+1):
        m=_NumberList[j]
        counter+=m
        _NumberList[j:j+i]-=m
    print(counter)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl
import numpy as np
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberTupleList.sort(key=lambda x:x[1])
NumberList=np.array([x[1] for x in NumberTupleList])
LengthOfNumberList=len(NumberList)

for i in range(1,N+1):
    counter=0
    _NumberList=np.array([x for x in NumberList])
    for j in range(0,LengthOfNumberList-i+1):
        m=min(_NumberList[j:j+i])
        counter+=m
        _NumberList[j:j+i]-=m
    print(counter)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl
import numpy as np
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberTupleList.sort(key=lambda x:x[1])
NumberList=np.array([x[1] for x in NumberTupleList])
LengthOfNumberList=len(NumberList)
for i in range(1,N+1):
    counter=0
    _NumberList=np.array([i for i in NumberList])
    for j in range(0,LengthOfNumberList-i+1):
        m=min(_NumberList[j:j+i])
        counter+=m
        _NumberList[j:j+i]-=m
    print(counter)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl
import numpy as np
N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberTupleList=c.most_common()
NumberTupleList.sort(key=lambda x:x[1])
NumberList=np.array([x[1] for x in NumberTupleList])
LengthOfNumberList=len(NumberList)
for i in range(1,N+1):
    counter=0
    _NumberList=[i for i in NumberList]
    for j in range(0,LengthOfNumberList-i+1):
        m=min(_NumberList[j:j+i])
        counter+=m
        _NumberList[j:j+i]-=m
    print(counter)

Submission status: Wrong Answer

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

B = [0 for _ in range(N)]
for i in A:
    B[i-1] += 1

for i in range(N):
    ans = 0
    C = B
    print(B)
    C = sorted(C, reverse = True)
    while C[i] != 0:
       
        for j in range(i+1):
               C[j] -= 1
        C = sorted(C, reverse = True)
        ans += 1
    print(ans)

Submission status: Wrong Answer

Solution code:
import sys 
import collections as cl

N=int(input())
A=list(map(int,sys.stdin.readline().split()))
c=cl.Counter(A)
NumberList=c.most_common()
NumberList.sort(key=lambda x:x[1])
LenghthOfNumberList=len(NumberList)
for i in range(1,N+1):
    counter=0
    NumOfSection=LenghthOfNumberList//i
    for j in range(0,NumOfSection):
        counter+=NumberList[j][1]
    print(counter)

Submission status: Wrong Answer

Solution code:
import bisect

n = int(input())
A = list(map(int, input().split()))
counts = [0]*(n+1)
for a in A:
    counts[a] += 1
counts = [count for count in counts if count != 0]
counts.sort()

cumsum = []
num = 0
for count in counts:
    num += count
    cumsum.append(num)

length = len(cumsum)
answers = []
for i in range(1, n+1):
    idx = bisect.bisect_right(counts, i)
    left = cumsum[idx-1]
    right = (length-idx)*i
    K = (right+left)//i
    answers.append([K, i])

now = 0
while answers:
    K, i = answers.pop()
    if K == now:
        continue
    for j in range(now, K):
        print(i)
    now = K

for i in range(n-now):
    print(0)

Submission status: Wrong Answer

Solution code:
import sys
input = sys.stdin.readline
 
#input
N = int(input())
A = list(map(int, input().split()))
 
#output
from collections import Counter
 
l = Counter(A).most_common()
l = [b for a, b in l]
 
maximum_operation = [0] * N
for K in range(len(l)):
    L = l
    while L[K] > 0:
        for i in range(K+1):
            L[i] -= 1
        L.sort(reverse = True)
        maximum_operation[K] += 1
 
for m in maximum_operation:
    print(m)

Submission status: Wrong Answer

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

A.sort()
D = [1]
t = A[0]
for i in range(1, N):
  if A[i] == t:
    D[-1] += 1
  else:
    D.append(1)
    t = A[i]

D.sort()
L = len(D)
S = [0] * L
S[0] = D[0]
for i in range(1, L):
  S[i] = S[i - 1] + D[i]

def hersCode(n):
  ok = 0
  ng = S[-1] + 1
  while abs(ok - ng) > 1:
    mid = abs(ok + ng) // 2
    if nasu(mid, n):
      ok = mid
    else:
      ng = mid
  return ok

def honya(n):
  ok = 0
  ng = len(D)
  while abs(ok - ng) > 1:
    mid = abs(ok + ng) // 2
    if D[mid] >= n:
      ok = mid
    else:
      ng = mid
  return ok

def nasu(x, n):
  a = honya(x)
  ans = a * x + S[L - a - 1]
  if ans >= n * x:
    return True
  else:
    return False

for i in range(1, N + 1):
  if L < i:
    print(0)
    continue
  print(hersCode(i))

Submission status: Wrong Answer

Solution code:
from collections import Counter
from bisect import bisect_right

N = int(input())
A = [int(i) for i in input().split()]

C = list(Counter(A).values())
C.sort()
S = C[::] + [0]

for i in range(1, len(S)) :
    S[i] += S[i-1]

for K in range(1, N + 1) :
    ok, ng = 0, N + 1
    while ng - ok > 1 :
        mid = (ng + ok) // 2
        l = bisect_right(C, mid) - 1
        if S[l] + mid * (len(C) - l - 1) >= K * mid :
            ok = mid
        else :
            ng = mid
    print(ok)

Submission status: Wrong Answer

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

#output
from collections import Counter
l = Counter(A)
l = l.most_common()

maximum_operation = [0] * N
for K in range(len(l)):
    l = Counter(A)
    l = l.most_common()
    while l[K][1] > 0:
        for i in range(K+1):
            l[i] = (l[i][0], l[i][1]-1)
            l = sorted(l, key = lambda x:x[1], reverse = True)
        maximum_operation[K] += 1

for m in maximum_operation:
    print(m)

Submission status: Wrong Answer

Solution code:
N=int(input())
A=list(map(int,input().split()))
from collections import Counter
c=Counter(A)
lst=[]
def judge(lst):#重複判定
    if len(set(lst))!=len(lst):
        return True
    else:
        return False

while len(c)>0:
    for (i,j) in c.most_common():
        lst.append(i)
        c[i]-=1
        if j==1:
            del c[i]
for k in range(1,N+1):
    ans=0
    x=len(lst)//k
    for m in range(x):
        lst_=lst[m*k:(m+1)*k]
        if judge(lst_):
            break
        ans+=1
    print(ans)

Submission status: Wrong Answer

Solution code:
# F - Distinct Numbers
def Distinct(N, A):
    uniq = sorted(set(A))
    uniq_num = len(uniq)

    ans = [0] * (N+1)
    ans[1] = N

    for i in range(2, N+1):
        if i > uniq_num: break
        ans[i] = uniq_num // i

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

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

Submission status: Wrong Answer

Solution code:
from collections import *
MAX = 3*pow(10,5) + 2
n = int(input())
a = list(map(int,input().split()))
b = [0 for i in range(MAX)]
c = [0 for i in range(MAX)]
for i in a:
    b[i] += 1
for i in b:
    c[i] += 1
s = n
last = n
print(last)
for k in range(2,n+1):
    while(s//k < last):
        for i in range(last,s//k,-1):
            s -= c[i]
            c[i-1] += c[i]
            c[i] = 0
        last = s//k
    print(last)

Submission status: Wrong Answer

Solution code:
import bisect

def f(x):
    return int(x) - 1

def choi_sort(ls):
    """
    引数はソート済みリストls
    ls[1] += ls[0]としたあと、ls[1:]をソート(ls[1]とどれかを入れ替える)
    ls[1]とls[1:]を返す
    """
    if ls[0] == 0:
        return ls[1], ls[1:]
        
    ls[1] += ls[0]
    a = bisect.bisect_left(ls[2:], ls[1]) + 2
    res = ls[2 : a] + [ls[1]]  +ls[a:]
    return res[0], res
    
N = int(input())
A = map(f, input().split())
C = [0]*N
for a in A:
    C[a] += 1
C = sorted(C)
    
ans = [0]*N
ans[0] = N
ans[N - 1] = C[0]
for i in range(N - 2, 0, - 1):
    x, C = choi_sort(C)
    ans[i] = x

for i in range(N):
    print(ans[i])

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random  # randome is not available at Codeforces
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
#eps=10**(-10)
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

n=I()
a=LI()
b=[(i,j) for i,j in Counter(a).items()]
b=sorted(b,key=lambda x:x[1])[::-1]
#show(b,a)

cnt=[0]*(n+1)
for i in a:
    cnt[i]+=1
cnt=sorted(cnt)[::-1]
#show(cnt)
pre=cnt[0]
c=0
f=[]
for i in range(n+1):
    #show(cnt[i])
    if cnt[i]==pre:
        c+=1
    else:
        #show(i,pre,cnt[i],c,f)
        f+=[c]*(pre-cnt[i])
        c+=1
        pre=cnt[i]
    if cnt[i]==0:
        break
#show(f)

def check(k):
    s=[]
    b=[]
    rt=0
    for i in f:
        
        if i<k:
            s.append(k-i)
        else:
            b.append(i%k)
            rt+=i//k
    b.sort()
    
    while s:
        c=s.pop()
        while len(b)>0:
            r=b.pop()
            if r>=c:
                rt+=1
        if len(b)==0:
            break
    
    return rt
    
for i in range(1,n+1):
    show(check(i))

Submission status: Wrong Answer

Solution code:
import collections
import bisect
n=int(input())
a=collections.Counter(map(int,input().split()))
a=list(a.values())
a.sort()
b=[0]*len(a)
b[0]=a[0]
for i in range(len(a)-1):
    b[i+1]=b[i]+a[i+1]
s=sum(a)
#print(a,b)
ans=[i for i in range(0,n+1)]
ans=ans[::-1]
for t in range(1,n+1):
    ANS=ans[n+(-n//t):]
    #print(ANS)
    for A in ANS:
        z=bisect.bisect_right(a,A)
        #print(z)
        if A*t<=b[z-1]+A*(len(b)-z):
            print(A)
            break

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    c = collections.Counter(LI())
    a = sorted(c.values(), reverse=True)
    al = len(a)
    l = n
    r = [n]
    for i in range(2,n+1):
        if al < i:
            r.append(0)
            continue
        l -= a[i-2]
        r.append(min(l, n//i, r[-1]))

    return JA(r, "\n")


print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    c = collections.Counter(LI())
    a = sorted(c.values(), reverse=True)
    al = len(a)
    l = n
    r = [n]
    for i in range(2,n+1):
        if al < i:
            r.append(0)
            continue
        l -= a[i-2]
        r.append(min(l, n//i))

    return JA(r, "\n")


print(main())

Submission status: Wrong Answer

Solution code:
import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    c = collections.Counter(LI())
    m = max(c.values())
    l = n - m
    r = [n]
    for i in range(2,n+1):
        r.append(min(l // (i-1), n // i))

    return JA(r, "\n")


print(main())

Submission status: Wrong Answer

Solution code:
import collections

n = int(input())
l = list(map(int,input().split()))
dic = collections.Counter(l)
val = sorted(dic.values())

print(n) # 1
for k in range(2, n+1):
    if len(val) < k:
        print(0)
    else:
        print(sum([min(k ,i) for i in val]) // k)

Submission status: Wrong Answer

Solution code:
from heapq import heappush, heappop
from collections import deque,defaultdict,Counter
import itertools
from itertools import permutations,combinations
import sys
import bisect
import string
#import math
#import time
#import random  # randome is not available at Codeforces
def I():
    return int(input())
def MI():
    return map(int,input().split())
def LI():
    return [int(i) for i in input().split()]
def LI_():
    return [int(i)-1 for i in input().split()]
def StoI():
    return [ord(i)-97 for i in input()]
def show(*inp,end='\n'):
    if show_flg:
        print(*inp,end=end)
YN=['Yes','No']
mo=10**9+7
inf=float('inf')
#eps=10**(-10)
#ts=time.time()
#sys.setrecursionlimit(10**6)
input=lambda: sys.stdin.readline().rstrip()

show_flg=False
show_flg=True

n=I()
a=LI()
b=[(i,j) for i,j in Counter(a).items()]
b=sorted(b,key=lambda x:x[1])[::-1]
show(b,a)

cnt=[0]*(n+1)
for i in a:
    cnt[i]+=1
cnt=sorted(cnt)[::-1]
show(cnt)
pre=cnt[0]
c=0
f=[]
for i in range(n+1):
    #show(cnt[i])
    if cnt[i]==pre:
        c+=1
    else:
        #show(i,pre,cnt[i],c,f)
        f+=[c]*(pre-cnt[i])
        c+=1
        pre=cnt[i]
    if cnt[i]==0:
        break
show(f)

for i in f:
    0

Submission status: Wrong Answer

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

from collections import Counter
from copy import deepcopy
from heapq import heapify, heappush, heappop


def main():
    n = int(input())
    a = list(map(int, input().split()))

    #n = 3 * 10 ** 5
    #a = list(range(1, n + 1))

    c = Counter(a)
    c = list(c.values())
    heapify(c)

    k_mx = len(c)

    for k in range(1, n + 1):
        if k > k_mx:
            print(0)
            continue

        cp = deepcopy(c)

        for _ in range(k_mx - k):
            continue
            cnt = heappop(cp)
            while cnt:
                mn = heappop(cp)
                cnt -= 1
                heappush(cp, mn + 1)

        ans = heappop(cp)
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

from collections import Counter
from copy import deepcopy
from heapq import heapify, heappush, heappop


def main():
    n = int(input())
    a = list(map(int, input().split()))

    #n = 3 * 10 ** 5
    #a = list(range(1, n + 1))

    c = Counter(a)
    c = list(c.values())
    heapify(c)

    k_mx = len(c)

    for k in range(1, n + 1):
        if k > k_mx:
            print(0)
            continue

        cp = deepcopy(c)

        if k == k_mx:
            ans = heappop(cp)
            print(ans)
            continue

        for _ in range(k_mx - k - 1):
            mn1 = heappop(cp)
            mn2 = heappop(cp)
            heappush(cp, mn1 + mn2)

        cnt = heappop(cp)
        while cnt:
            mn = heappop(cp)
            cnt -= 1
            heappush(cp, mn + 1)

        ans = heappop(cp)
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

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

aa = list(set(a))
nn = len(aa)

# k=1
print(n)

# k>=2
for k in range(2, n+1):
    print(nn // k)

Submission status: Wrong Answer

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

from collections import Counter
from copy import deepcopy
from heapq import heapify, heappush, heappop


def main():
    n = int(input())
    a = list(map(int, input().split()))

    #n = 3 * 10 ** 5
    #a = list(range(1, n + 1))

    c = Counter(a)
    c = list(c.values())
    heapify(c)

    k_mx = len(c)

    for k in range(1, n + 1):
        if k > k_mx:
            print(0)
            continue

        cp = deepcopy(c)
        for _ in range(k_mx - k):
            mn1 = heappop(cp)
            mn2 = heappop(cp)
            heappush(cp, mn1 + mn2)

        ans = heappop(cp)
        print(ans)


if __name__ == "__main__":
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import collections

def solve(N: int, A: "List[int]"):
    counter = sorted(list(collections.Counter(A).values()),reverse=True)
    c_index = 0
    k=0
    for i in range(1,N+1):
        k+=1
        # if len(counter)<i:
        #     print(0)
        #     continue
        while counter[c_index]*k > N and c_index<len(counter)-1:
            N-=counter[c_index]
            c_index+=1
            k-=1
        print(N//k)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:

N = int(input())

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

dic = {}

for a in A:

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

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

B.sort()

B_sub = B.copy()

for i in range(len(B)-1):
    B_sub[i+1] += B_sub[i] 

aind = N + 1
nind = len(B) - 1

#print (B,B_sub)

for i in range(N):

    i += 1

    while True:

        while nind > 0 and B[nind] > aind - 1:

            nind -= 1

        if ((len(B) - 1) - nind ) * (aind-1) + B_sub[nind] >= (aind - 1) * i:
            print (aind - 1)
            break

        aind -= 1

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import collections

def solve(N: int, A: "List[int]"):
    counter = sorted(list(collections.Counter(A).values()),reverse=True)
    for i in range(1,N+1):
        c_index = 0
        n = N
        k = i 
        while counter[c_index]*k > n and c_index<len(counter)-1:
            n-=counter[c_index]
            c_index+=1
            k-=1
        print(n//k)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import collections

def solve(N: int, A: "List[int]"):
    counter = sorted(list(collections.Counter(A).values()),reverse=True)
    for i in range(1,N+1):
        c_index = 0
        n = N
        k=i
        while counter[c_index]*k > n and c_index<len(counter)-1 and k>1:
            n-=counter[c_index]
            c_index+=1
            k-=1
        print(n//k)
    return

def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7



n = I()
L = [(0, 0)] + sorted([(k, v) for k, v in Counter(Counter(LI()).values()).items()])
m = len(L)
acc = [0] * m
ret = 0
for j in range(m):
    k, v = L[j]
    ret += k * v
    acc[j] = ret



for i in range(1, n + 1):
    ok = 0
    ng = n // i + 1
    while ng > ok + 1:
        mid = (ng + ok) // 2
        lower_num = bisect_right(L, (mid, INF))
        if acc[lower_num - 1] + (m - lower_num) * mid >= i * mid:
            ok = mid
        else:
            ng = mid
    print(ok)

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import heapq
import copy


def main():
  input()
  values = list(map(int, input().split()))
  counts = [0] * len(values)

  for v in values:
    counts[v - 1] += 1

  heapq.heapify(counts)

  print(len(values))

  for k in range(2, len(values)):
    cs = copy.copy(counts)

    while len(cs) != k:
      n = heapq.heappop(cs)

      if n == 0:
        continue

      m = heapq.heappop(cs)
      heapq.heappush(cs, n + m)

    print(heapq.heappop(cs))

  print(heapq.heappop(counts))


if __name__ == '__main__':
  main()

Submission status: Wrong Answer

Solution code:
#!/usr/bin/env python3
import sys
import collections
import copy
def dellist(items, indexes):
    for index in sorted(indexes, reverse=True):
        del items[index]

def solve(N: int, A: "List[int]"):
    counter = list(collections.Counter(A).values())

    for i in range(1,N+1):
        c = copy.deepcopy(counter)
        answer = 0
        while c:
            if len(c) < i:
                break
            remove_index = []
            for j in range(i):
                c[j]-=1
                if c[j] == 0:
                    remove_index.append(j)
            if remove_index:
                dellist(c,remove_index)
            answer += 1
        print(answer)
    return


# Generated by 1.1.6 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    A = [int(next(tokens)) for _ in range(N)]  # type: "List[int]"
    solve(N, A)

if __name__ == '__main__':
    main()

Submission status: Wrong Answer

Solution code:
from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
from bisect import bisect_left, bisect_right
import random
from itertools import permutations, accumulate, combinations
import sys
import string



INF = float('inf')
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return sys.stdin.readline().strip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]
mod = 10 ** 9 + 7



n = I()
L = sorted([(k, v) for k, v in Counter(Counter(LI()).values()).items()])
m = len(L)
acc = [0] * m
ret = 0
for j in range(m):
    k, v = L[j]
    ret += k * v
    acc[j] = ret



v_list = [v for k, v in L]
for k in range(m - 1, 0, -1):
    v_list[k - 1] += v_list[k]




for i in range(1, n + 1):
    ok = 0
    ng = n // i + 1
    while ng > ok + 1:
        mid = (ng + ok) // 2
        lower_num = bisect_right(L, (mid, INF))
        if acc[lower_num - 1] + (m - lower_num) * mid >= i * mid:
            ok = mid
        else:
            ng = mid
    print(ok)

Submission status: Wrong Answer

Solution code:
from collections import Counter
from bisect import bisect_right

N = int(input())
A = list(map(int, input().split()))
a = list(Counter(A).values())
a.sort()
s = sum(a)

for i in range(1, N + 1):
    if i == 1:
        print(s)
    elif len(a) < i:
        print(0)
    else:
        n = s // i
        t = bisect_right(a, n)
        if n == (sum(a[:t]) + i * (len(a) - t)) // i:
            print(n)
        else:
            print(n - 1)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
a = list(Counter(A).values())
s = sum(a)

for i in range(1, N + 1):
    if i == 1:
        print(s)
    elif len(a) < i:
        print(0)
    else:
        temp = s // i
        print(sum([j if j <= temp else temp for j in a]) // i)

Submission status: Wrong Answer

Solution code:
from collections import Counter
N = int(input())
A = list(map(int, input().split()))
a = list(Counter(A).values())
s = sum(a)

for i in range(1, N + 1):
    if i == 1:
        print(s)
    else:
        temp = s // i
        print(sum([j if j <= temp else temp for j in a]) // i)