You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

18 lines
360 B
C++

#include <iostream>
#include <map>
using namespace std;
int main()
{
int n;
map<int, int> M;
cin >> n;
for (int i = 0, x; i < n; i++)
{
cin >> x;
M[x]++;
}
for (map<int, int>::iterator ite = M.begin(); ite != M.end(); ++ite)
cout << ite->first << " " << ite->second << endl;
return 0;
}