やるだけ
class ColorfulRabbits { public: int getMinimum(vector <int> R) { map<int, int> cnt; for (int i = 0; i < (int)R.size(); ++i) { ++cnt[R[i]]; } int res = cnt[0]; FOR (i, cnt) { if (i->first == 0) continue; int a = i->first + 1; int b = i->second; res += ((b / a) + (bool)(b % a)) * a; } return res; } };