提交时间:2022-08-18 10:57:33
运行 ID: 55405
#include <bits/stdc++.h> using namespace std; int maxn = -1, n, m, i, j, ans[11], tmp; inline int read() { int x = 0, f = 1; char ch = getchar(); while (ch < '0' || ch > '9') { if (ch == '-') f = -1; ch = getchar(); } while (ch >= '0' && ch <= '9') x = x * 10 + ch - '0', ch = getchar(); return x * f; } int main() { n = read(); m = read(); int nm = n * m; ans[1] = nm; for (i = 1; i <= nm; i++) { tmp = read(); maxn = max(maxn, tmp); while (tmp >= 2) { ans[tmp]++; tmp--; } } cout << maxn << endl; for (i = 1; i <= maxn; i++) { cout << ans[i] << endl; } return 0; }