81002024-01-12 13:09:30David9320Hús sütés (75 pont)cpp17Accepted 75/7548ms4952 KiB
#include <iostream>
#include <vector>
#include <algorithm>

using namespace std;

int main()
{
    int n;
    cin >> n;

    vector<int> husik(n);

    for(int i = 0; i < n; i++) {
        cin >> husik[i];
    }

    sort(husik.rbegin(), husik.rend());

    int maximum = 0;
    for(int i = 0; i < n; i++) {
        if(maximum < husik[i] + i) {
            maximum = husik[i] + i;
        }
    }

    cout << maximum;

    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1852 KiB
2Accepted0/03ms2004 KiB
3Accepted0/025ms2532 KiB
4Accepted3/33ms2432 KiB
5Accepted3/33ms2636 KiB
6Accepted3/33ms2848 KiB
7Accepted3/33ms3060 KiB
8Accepted4/43ms3280 KiB
9Accepted4/43ms3388 KiB
10Accepted4/43ms3592 KiB
11Accepted4/43ms3704 KiB
12Accepted4/43ms3672 KiB
13Accepted4/446ms4508 KiB
14Accepted4/448ms4588 KiB
15Accepted5/546ms4588 KiB
16Accepted5/548ms4592 KiB
17Accepted5/548ms4592 KiB
18Accepted4/448ms4720 KiB
19Accepted4/448ms4952 KiB
20Accepted4/443ms4804 KiB
21Accepted4/434ms4800 KiB
22Accepted2/243ms4804 KiB
23Accepted2/220ms4804 KiB