結果
問題 |
No.3297 Bake Cookies
|
ユーザー |
|
提出日時 | 2025-10-05 14:14:12 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 1,111 ms / 2,000 ms |
コード長 | 1,043 bytes |
コンパイル時間 | 191 ms |
コンパイル使用メモリ | 82,848 KB |
実行使用メモリ | 134,048 KB |
最終ジャッジ日時 | 2025-10-05 14:14:42 |
合計ジャッジ時間 | 27,503 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
# 自作ライブラリ # https://github.com/takumi-okamoto/competitive-programming-public/tree/main/mylib import sys from collections import Counter import heapq # sys.setrecursionlimit(10**8) def debug(*args): print(*args, file=sys.stderr) def main(): n, m, t = map(int, input().split()) a = list(map(int, input().split())) c = Counter(a) times = [None] + [0] * (n + 1) que = [] for i in range(1, n + 1): if c[i] > 0: que.append((1, i, i)) else: que.append((t, i, n + 1)) heapq.heapify(que) for _ in range(m): t_, idx, target = heapq.heappop(que) if idx == target: times[idx] = t_ c[idx] -= 1 if c[idx] > 0: heapq.heappush(que, (t_ + 1, idx, target)) else: heapq.heappush(que, (t_ + t, idx, n + 1)) else: times[idx] = t_ heapq.heappush(que, (t_ + t, idx, n + 1)) print(max(times[1:])) if __name__ == "__main__": main()