結果
問題 |
No.3297 Bake Cookies
|
ユーザー |
![]() |
提出日時 | 2025-10-05 13:46:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 122 ms / 2,000 ms |
コード長 | 671 bytes |
コンパイル時間 | 4,778 ms |
コンパイル使用メモリ | 334,848 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-10-05 13:47:29 |
合計ジャッジ時間 | 9,010 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 27 |
ソースコード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; using mint = modint998244353; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int N, M; ll T; cin >> N >> M >> T; vector<int> cnt(N); for(int i = 0, a; i < M; i++) { cin >> a; cnt[a - 1]++; } ll ng = 0, ok = 3e14; while(ng + 1 < ok) { ll k = (ng + ok) / 2; ll p = 0, q = 0; for(int i = 0; i < N; i++) { if(cnt[i] <= k) p += (k - cnt[i]) / T; else q += cnt[i] - k; } (q <= p ? ok : ng) = k; } cout << ok << endl; }