結果
| 問題 |
No.3297 Bake Cookies
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-10-05 13:51:20 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 136 ms / 2,000 ms |
| コード長 | 1,178 bytes |
| コンパイル時間 | 4,907 ms |
| コンパイル使用メモリ | 335,520 KB |
| 実行使用メモリ | 15,744 KB |
| 最終ジャッジ日時 | 2025-10-05 13:52:19 |
| 合計ジャッジ時間 | 9,270 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 27 |
ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
#define all(v) v.begin(), v.end()
#define SORT(v) sort(v.begin(), v.end())
#define RSORT(v) sort(v.rbegin(), v.rend())
#define REVERSE(v) reverse(v.begin(), v.end())
#define ll long
#define ld long double
#define int ll
int32_t main() {
int n, m, t;
cin >> n >> m >> t;
vector<int> a(m);
for (int i = 0; i < m; i++) {
cin >> a[i];
a[i]--;
}
vector<int> times(n, 0);
for (int i = 0; i < m; i++) {
times[a[i]]++;
}
SORT(times);
multiset<int> times_set;
for (int i = 0; i < n; i++) {
times_set.insert(times[i]);
}
while (true) {
int min_time = *times_set.begin();
int max_time = *times_set.rbegin();
int new_min_time = min_time + t;
int new_max_time = max_time - 1;
if (new_min_time >= max_time) {
break;
}
times_set.erase(times_set.find(min_time));
times_set.erase(times_set.find(max_time));
times_set.insert(new_min_time);
times_set.insert(new_max_time);
}
cout << *times_set.rbegin() << endl;
}