40172023-03-09 08:20:15kdbBejgli (80 pont)cpp17Accepted 80/8013ms4004 KiB
#include <iostream>
#include <vector>
#include <unordered_map>
using namespace std;

int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);

    int n;
    cin >> n;
    unordered_map<int, int>m;
    for (int i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        m[a]++;
    }
    int db = 0;
   
    int maxi = 0, mh = 0;
    for (auto i : m)
    {
        if (i.second / i.first > maxi)
        {
            maxi = i.second / i.first;
            mh = i.first;
        }
        db += i.second / i.first;
    }
    cout << db << endl << mh << endl;
    return 0;
}
/*
7
1 1 3 3 3 2 2
*/
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms2104 KiB
2Accepted0/03ms2152 KiB
3Accepted4/43ms2388 KiB
4Accepted4/43ms2576 KiB
5Accepted4/42ms2580 KiB
6Accepted4/42ms2588 KiB
7Accepted4/43ms2756 KiB
8Accepted4/43ms2972 KiB
9Accepted4/43ms3060 KiB
10Accepted4/43ms3188 KiB
11Accepted4/43ms3264 KiB
12Accepted4/43ms3400 KiB
13Accepted4/43ms3608 KiB
14Accepted4/43ms3700 KiB
15Accepted4/44ms3692 KiB
16Accepted4/44ms3688 KiB
17Accepted4/47ms3692 KiB
18Accepted4/410ms3824 KiB
19Accepted4/412ms3936 KiB
20Accepted4/412ms3940 KiB
21Accepted4/413ms3900 KiB
22Accepted4/410ms4004 KiB