結果

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

ソースコード

diff #

def binary_search(f):
    left,right=0,10**9+1
    while right-left>1:
        mid=(right+left)//2
        if not f(mid):
            left=mid
        else:
            right=mid
    return right

from collections import defaultdict
def f(x):
    rest = 0
    for i in range(N):
        rest-=max(0,dic[i]-x)
        rest+=max(0,(x-dic[i])//T)
    return rest >= 0
    

N,M,T=map(int,input().split())
A=list(map(int,input().split()))
dic=[0]*N
for a in A:
    dic[a-1]+= 1
print(binary_search(f))
0