Submission #8043347


Source Code Expand

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

"""
・大きいKから見る
・a_N <= S//K:全て取り切れて、S//Kが解
・a_N > S/K:a_Nは常に選ぶとしてよい。K-1枚でa_{N-1}までのゲームに帰着
"""

from collections import Counter

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

counter = Counter(A)
C = list(counter.values())
C.sort()
S = sum(C)

answer = []
removed = 0
for K in range(1,N+1):
    rest = K - removed
    while C and C[-1] > S//rest:
        S -= C[-1]
        C.pop()
        removed += 1
        rest -= 1
    answer.append(S//rest)

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

Submission Info

Submission Time
Task F - Distinct Numbers
User maspy
Language Python (3.4.3)
Score 600
Code Size 702 Byte
Status AC
Exec Time 421 ms
Memory 51500 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 600 / 600
Status
AC × 3
AC × 40
Set Name Test Cases
Sample 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt
All 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-small-01.txt, 01-small-02.txt, 01-small-03.txt, 01-small-04.txt, 01-small-05.txt, 01-small-06.txt, 01-small-07.txt, 01-small-08.txt, 01-small-09.txt, 01-small-10.txt, 02-medium-01.txt, 02-medium-02.txt, 02-medium-03.txt, 02-medium-04.txt, 02-medium-05.txt, 02-medium-06.txt, 02-medium-07.txt, 02-medium-08.txt, 02-medium-09.txt, 02-medium-10.txt, 11-large-01.txt, 11-large-02.txt, 11-large-03.txt, 21-biased-01.txt, 21-biased-02.txt, 21-biased-03.txt, 31-uni-01.txt, 31-uni-02.txt, 31-uni-03.txt, 41-distinct-01.txt, 41-distinct-02.txt, 41-distinct-03.txt, 51-min-01.txt, 52-max-01.txt, 52-max-02.txt, 52-max-03.txt, 61-sqrt-01.txt
Case Name Status Exec Time Memory
00-sample-01.txt AC 20 ms 3316 KiB
00-sample-02.txt AC 20 ms 3316 KiB
00-sample-03.txt AC 21 ms 3316 KiB
01-small-01.txt AC 20 ms 3316 KiB
01-small-02.txt AC 20 ms 3316 KiB
01-small-03.txt AC 20 ms 3316 KiB
01-small-04.txt AC 20 ms 3316 KiB
01-small-05.txt AC 20 ms 3316 KiB
01-small-06.txt AC 20 ms 3316 KiB
01-small-07.txt AC 20 ms 3316 KiB
01-small-08.txt AC 20 ms 3316 KiB
01-small-09.txt AC 20 ms 3316 KiB
01-small-10.txt AC 20 ms 3316 KiB
02-medium-01.txt AC 21 ms 3316 KiB
02-medium-02.txt AC 21 ms 3316 KiB
02-medium-03.txt AC 21 ms 3316 KiB
02-medium-04.txt AC 21 ms 3316 KiB
02-medium-05.txt AC 20 ms 3316 KiB
02-medium-06.txt AC 20 ms 3316 KiB
02-medium-07.txt AC 20 ms 3316 KiB
02-medium-08.txt AC 21 ms 3316 KiB
02-medium-09.txt AC 20 ms 3316 KiB
02-medium-10.txt AC 21 ms 3316 KiB
11-large-01.txt AC 265 ms 31052 KiB
11-large-02.txt AC 272 ms 32164 KiB
11-large-03.txt AC 318 ms 36864 KiB
21-biased-01.txt AC 283 ms 35492 KiB
21-biased-02.txt AC 297 ms 37536 KiB
21-biased-03.txt AC 195 ms 23916 KiB
31-uni-01.txt AC 184 ms 31284 KiB
31-uni-02.txt AC 199 ms 32504 KiB
31-uni-03.txt AC 227 ms 37216 KiB
41-distinct-01.txt AC 221 ms 41288 KiB
41-distinct-02.txt AC 253 ms 45488 KiB
41-distinct-03.txt AC 313 ms 51020 KiB
51-min-01.txt AC 20 ms 3316 KiB
52-max-01.txt AC 411 ms 51244 KiB
52-max-02.txt AC 412 ms 51500 KiB
52-max-03.txt AC 421 ms 51336 KiB
61-sqrt-01.txt AC 222 ms 36664 KiB