You are viewing a single comment's thread. Return to all comments →
A faster and more efficient solution would be to just consecutively remove all occurrences of the the smallest element. It works!
int main() { int n,m; cin>>n; multiset<int>s; while(n--) { cin>>m; s.emplace(m); } while(s.size()>0) { cout<<s.size()<<endl; s.erase(*min_element(s.begin(),s.end())); } return 0; }
Seems like cookies are disabled on this browser, please enable them to open this website
Cut the sticks
You are viewing a single comment's thread. Return to all comments →
A faster and more efficient solution would be to just consecutively remove all occurrences of the the smallest element. It works!