2 solutions

  • 1
    @ 2026-5-16 15:18:22
    #include<bits/stdc++.h>
    using namespace std;
    int main()
    {
    	int n;
    	cin>>n;
    	map<int,int> h;
    	for(int i=1;i<=n;i++)
    	{
    		int x;
    		cin>>x;
    		h[x]++;
    	}
    	for(auto it=h.rbegin();it!=h.rend();it++) 
    	{
    		cout<<it->second<<endl;
    	}
    	for(int i=1;i<=n-h.size();i++)
    	{
    		cout<<"0"<<endl;
    	}
    	return 0;	
    }

    Information

    ID
    2623
    Time
    1000ms
    Memory
    256MiB
    Difficulty
    3
    Tags
    # Submissions
    7
    Accepted
    7
    Uploaded By