結果

問題 No.3297 Bake Cookies
コンテスト
ユーザー Kohei
提出日時 2026-08-17 21:09:14
言語 PyPy3
(8.0.0 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 136 ms / 2,000 ms
+ 156µs
コード長 597 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 86 ms
コンパイル使用メモリ 64,396 KB
実行使用メモリ 87,532 KB
最終ジャッジ日時 2026-10-17 03:46:25
合計ジャッジ時間 5,879 ms
ジャッジサーバーID
(参考情報)
judge4_0 / judge5_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 29
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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

def solve(m): # m分以内に全て焼けるか?
    total = 0
    for c in cnt:
        if c > m:
            # c - m 枚を別オーブンに委託
            total -= c - m
        elif c == m:
            # このオーブン内で需給が簡潔
            pass
        else:
            total += (m - c)//T
    return total >= 0

ok = 10**18
ng = 0
while abs(ok - ng) != 1:
    mid = (ok + ng)//2
    if solve(mid):
        ok = mid
    else:
        ng = mid
print(ok)
0