17772022-12-02 22:36:17kdbHús sütés (75 pont)cpp11Accepted 75/7523ms5168 KiB
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main()
{
    cin.tie(nullptr);
    cout.tie(nullptr);
    ios_base::sync_with_stdio(false);
    int n, m=0;
    cin >> n;
    vector<int>vec;
    for (size_t i = 0; i < n; i++)
    {
        int a;
        cin >> a;
        vec.push_back(a);
    }
    sort(vec.begin(), vec.end());
    for (int i = 0; i < n; i++)
    {
        m = max(m, vec[i] + n - i - 1);
    }
    cout << m << endl;
    return 0;
}
/*
5
3 4 9 2 1
-9

5
5 4 3 5 3
-7
*/
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1828 KiB
2Accepted0/02ms2056 KiB
3Accepted0/012ms2860 KiB
4Accepted3/32ms2380 KiB
5Accepted3/32ms2596 KiB
6Accepted3/32ms2788 KiB
7Accepted3/32ms2984 KiB
8Accepted4/42ms3064 KiB
9Accepted4/42ms3192 KiB
10Accepted4/42ms3436 KiB
11Accepted4/42ms3420 KiB
12Accepted4/42ms3488 KiB
13Accepted4/423ms4688 KiB
14Accepted4/423ms4684 KiB
15Accepted5/521ms4956 KiB
16Accepted5/523ms4820 KiB
17Accepted5/523ms4812 KiB
18Accepted4/423ms4888 KiB
19Accepted4/423ms4884 KiB
20Accepted4/416ms4944 KiB
21Accepted4/417ms5012 KiB
22Accepted2/220ms5168 KiB
23Accepted2/210ms5016 KiB