Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <map>
- using namespace std;
- int main()
- {
- long long n, m;
- long long res=0;
- map<int, int> mapp;
- cin >> n;
- int ll;
- for (int i=0; i<n; i++){
- cin >> ll;
- mapp[ll]++;
- }
- bool b;
- int prev;
- while (true){
- b = false;
- if (mapp.size()>0){
- for (auto &mm:mapp){
- res++;
- mm.second--;
- if (mm.second==0)
- mapp.erase(mm.first);
- b = true;
- }
- }
- res--;
- if (!b)
- break;
- }
- res++;
- cout << res;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement