48582023-04-03 08:04:59EyusieBejgli (80 pont)cpp17Accepted 80/8034ms5324 KiB
#include <bits/stdc++.h>

using namespace std;
int n, temp;
int db = 0;
int legt = 0;
int legtind;
bool x;
vector<int> a;
int main()
{
    cin >> n;
    a.assign(n+1, 0);
    for(int i = 0; i < n; i++)
    {
        cin >> temp;
        a[temp]++;
    }

    for(int i = 1; i <= n; i++)
    {
        db+= a[i]/i;
        x = (legt<a[i]/i);
        legt = a[i]/i*x + legt*!x;
        legtind = i*x + legtind*!x;
    }
    cout << db << "\n" << legtind;
}
SubtaskSumTestVerdictTimeMemory
base80/80
1Accepted0/03ms1744 KiB
2Accepted0/03ms2036 KiB
3Accepted4/42ms2252 KiB
4Accepted4/43ms2460 KiB
5Accepted4/43ms2712 KiB
6Accepted4/43ms2924 KiB
7Accepted4/43ms3128 KiB
8Accepted4/43ms3292 KiB
9Accepted4/43ms3516 KiB
10Accepted4/43ms4000 KiB
11Accepted4/43ms3836 KiB
12Accepted4/43ms3852 KiB
13Accepted4/44ms3936 KiB
14Accepted4/44ms4196 KiB
15Accepted4/46ms4168 KiB
16Accepted4/46ms4324 KiB
17Accepted4/413ms4460 KiB
18Accepted4/419ms5112 KiB
19Accepted4/427ms5192 KiB
20Accepted4/427ms5324 KiB
21Accepted4/434ms5304 KiB
22Accepted4/423ms5308 KiB