ACGO欢乐赛#42-题解
2025-03-09 22:05:09
发布于:广东
33阅读
0回复
0点赞
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n,_,cnt=0;
cin>>n;
map<int,int>a;
for(int i=0;i<n;i++)
{
cin>>_;
a[_]++;
}
while(!a.empty())
{
for(auto x=a.begin();x!=a.end();)
{
cnt++;
x->second--;
if(x->second==0) a.erase(x++);
else x++;
}
cnt--;
}
cout<<cnt;
}
这里空空如也
有帮助,赞一个