結果

問題 No.3297 Bake Cookies
コンテスト
ユーザー N-noa21
提出日時 2025-11-12 14:18:36
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 123 ms / 2,000 ms
コード長 516 bytes
コンパイル時間 381 ms
コンパイル使用メモリ 82,840 KB
実行使用メモリ 106,500 KB
最終ジャッジ日時 2025-11-12 14:18:43
合計ジャッジ時間 6,330 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 27
権限があれば一括ダウンロードができます

ソースコード

diff #

N,M,T = map(int, input().split())
A = list(map(int, input().split()))
cnt = [0] * N
for i in A:
    cnt[i-1] += 1
#print(cnt)

def is_ok(arg):
    rest = 0
    for i in cnt:
        if i > arg:
            rest += i-arg
        elif i < arg:
            rest -= (arg-i) // T
    return rest <= 0


def meguru_bisect(ng, ok):
    while (abs(ok - ng) > 1):
        mid = (ok + ng) // 2
        if is_ok(mid):
            ok = mid
        else:
            ng = mid
    return ok

id = meguru_bisect(0,10**14)
print(id)
0