/* -*- coding: utf-8 -*- * * 3297.cc: No.3297 Bake Cookies - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 200000; const int MAX_M = 200000; /* typedef */ using ll = long long; /* global variables */ int as[MAX_M], cs[MAX_N]; /* subroutines */ bool check(int n, int t, int x) { ll rsum = 0; for (int i = 0; i < n; i++) { if (x >= cs[i]) rsum += (x - cs[i]) / t; else rsum -= (cs[i] - x); } return (rsum >= 0); } /* main */ int main() { int n, m, t; scanf("%d%d%d", &n, &m, &t); for (int i = 0; i < m; i++) scanf("%d", as + i), as[i]--; for (int i = 0; i < m; i++) cs[as[i]]++; int x0 = -1, x1 = *max_element(cs, cs + n); while (x0 + 1 < x1) { int x = (x0 + x1) / 2; if (check(n, t, x)) x1 = x; else x0 = x; } printf("%d\n", x1); return 0; }