結果

問題 No.3297 Bake Cookies
ユーザー wasd314
提出日時 2025-10-05 13:44:23
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 122 ms / 2,000 ms
コード長 493 bytes
コンパイル時間 197 ms
コンパイル使用メモリ 82,172 KB
実行使用メモリ 115,476 KB
最終ジャッジ日時 2025-10-05 13:44:44
合計ジャッジ時間 4,266 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m, t = map(lambda s_: int(s_), input().split())
a = tuple(map(lambda s_: int(s_) - 1, input().split()))
fav = [0] * n
for ai in a:
    fav[ai] += 1

def pred(x):
    over = 0
    slow = 0
    for ai in fav:
        if ai <= x:
            slow += (x - ai) // t
        else:
            over += ai - x
    return over <= slow

ng = 0
ok = 1
while not pred(ok):
    ok *= 2
while abs(ok - ng) > 1:
    mi = (ok + ng) // 2
    if pred(mi):
        ok = mi
    else:
        ng = mi
print(ok)
0