fork(1) download
  1. #include <bits/stdc++.h>
  2. #define ll long long
  3. #define endl "\n"
  4. #define F first
  5. #define S second
  6. #define loop(a,n) for(int i=a; i<=n ; i++)
  7. #define TIME (1.0 * clock() / CLOCKS_PER_SEC)
  8. #define NAME ""
  9. using namespace std;
  10. struct t{
  11. int gd, dem;
  12. };
  13. ll m, n, x;
  14. t d[101];
  15. bool cmp (t a, t b){
  16. return a.dem > b. dem;
  17. }
  18. int main(){
  19. ios_base::sync_with_stdio(0);
  20. cin.tie(0); cout.tie(0);
  21. cin >> m >> n;
  22. loop(1,m*n) {
  23. cin >> x;
  24. d[x].gd = x;
  25. d[x].dem++;
  26. }
  27. sort(d,d+100,cmp);
  28. loop(0,100) {
  29. if(d[i].dem != 0 ) {
  30. cout << d[i].gd << ":" << d[i].dem << endl;
  31. }
  32. }
  33. return 0;
  34. }
  35.  
Success #stdin #stdout 0s 5300KB
stdin
Standard input is empty
stdout
Standard output is empty