結果
問題 |
No.3297 Bake Cookies
|
ユーザー |
![]() |
提出日時 | 2025-10-05 16:51:56 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 947 bytes |
コンパイル時間 | 2,812 ms |
コンパイル使用メモリ | 278,300 KB |
実行使用メモリ | 7,716 KB |
最終ジャッジ日時 | 2025-10-05 16:52:05 |
合計ジャッジ時間 | 8,701 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 19 WA * 8 |
ソースコード
#include "bits/stdc++.h" using namespace std; #define rep(i,s,t) for (auto i=s; i != t; ++i) #define rrep(i,s,t) for (auto i=t; i-- != s;) typedef long long ll; constexpr auto inf = numeric_limits<ll>::max() / 2; constexpr bool chmin(auto &a, auto const &x) { return a > x ? a = x, true : false; } constexpr bool chmax(auto &a, auto const &x) { return a < x ? a = x, true : false; } // constexpr auto ascii_lowercase = "qwertyuiopasdfghjklzxcvbnm"sv; int main() { int N, M, T; cin >> N >> M >> T; vector<int> Cnt(N); while (M--) { int a; cin >> a; --a; Cnt[a] += 1; } auto f = [&](ll const t) -> bool { ll use=0; for (int const c : Cnt) { if (c <= t) use -= (t - c) / T; else use += c - t; } return use <= 0; }; ll ok=inf, ng=0; while (ok - ng > 1) { ll const m = midpoint(ok, ng); if (f(m)) ok = m; else ng = m; } cout << ok << endl; }