結果
| 問題 | No.3297 Bake Cookies | 
| コンテスト | |
| ユーザー |  rinrion | 
| 提出日時 | 2025-10-05 16:06:41 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 109 ms / 2,000 ms | 
| コード長 | 1,080 bytes | 
| コンパイル時間 | 3,440 ms | 
| コンパイル使用メモリ | 230,132 KB | 
| 実行使用メモリ | 13,924 KB | 
| 最終ジャッジ日時 | 2025-10-05 16:06:51 | 
| 合計ジャッジ時間 | 6,558 ms | 
| ジャッジサーバーID (参考情報) | judge5 / judge3 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| other | AC * 27 | 
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:32:19: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   32 |         for (auto [x, y] : mp){
      |                   ^
main.cpp:37:19: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   37 |         for (auto [x, y] : mp){
      |                   ^
            
            ソースコード
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using namespace atcoder;
using ll = long long;
using vi = vector<int>;
using vvi = vector<vi>;
using vl = vector<ll>;
using vvl = vector<vl>;
using vs = vector<string>;
using vp = vector<pair<int, int>>;
#define rep(i, s, n) for (int i = s; i < (int)(n); i++)
#define sz(x) ((int)(x).size())
constexpr int INFI = 1001001001;
constexpr ll INFL = (1LL << 60);
int main (){
	ios::sync_with_stdio(false);
	cin.tie(nullptr);
	// input
	ll n, m, t;
	cin >> n >> m >> t;
	vl a (m);
	map<ll, ll> mp;
	rep(i, 0, m){
		cin >> a[i];
		mp[a[i]] ++;
	}
	ll mx = 0;
	for (auto [x, y] : mp){
		mx = max(mx, y);
	}
	vl b;
	for (auto [x, y] : mp){
		b.push_back(y);
	}
	sort (b.begin(), b.end());
	while(true){
		ll mn = b[0];
		ll mx = b[sz(b) - 1];
		if(mx - mn > t - 1){
			b[0] ++;
			b[sz(b) - 1] --;
			mx = min(mx, mx + t - 1);
			sort (b.begin(), b.end());
		}
		else break;
		// cerr <<"mx: "<< mx << "\n" ;
	}
	cerr <<"b:\n";
	// for (auto x: b) {cerr << x <<" ";} cerr << "\n" ;
	cout << mx<< endl;
	return 0;
}
            
            
            
        