48572023-04-03 07:58:33EyusieBejgli (80 pont)cpp17Accepted 80/8032ms5096 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    int n;
    cin >> n;
    vector<int> a(n+1, 0);
    int temp;
    for(int i = 0; i < n; i++)
    {
        cin >> temp;
        a[temp]++;
    }
    int db = 0;
    int legt = 0;
    int legtind;
    for(int i = 1; i <= n; i++)
    {
        db+= a[i]/i;
        if(legt < a[i]/i)
        {
            legt = a[i]/i;
            legtind = i;
        }
    }
    cout << db << "\n" << legtind;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms2092 KiB
2Accepted0/03ms2228 KiB
3Accepted4/43ms2260 KiB
4Accepted4/43ms2432 KiB
5Accepted4/42ms2512 KiB
6Accepted4/43ms2912 KiB
7Accepted4/43ms2928 KiB
8Accepted4/43ms3172 KiB
9Accepted4/43ms3292 KiB
10Accepted4/43ms3436 KiB
11Accepted4/43ms3692 KiB
12Accepted4/43ms3748 KiB
13Accepted4/44ms3752 KiB
14Accepted4/44ms3760 KiB
15Accepted4/46ms4112 KiB
16Accepted4/46ms4192 KiB
17Accepted4/413ms4568 KiB
18Accepted4/419ms5044 KiB
19Accepted4/427ms5044 KiB
20Accepted4/427ms4972 KiB
21Accepted4/432ms4964 KiB
22Accepted4/421ms5096 KiB