Submission #866382

#TimeUsernameProblemLanguageResultExecution timeMemory
866382Tejas_MondeeriHindeks (COCI17_hindeks)C++14
50 / 50
149 ms5716 KiB
// Hindeks

#include <bits/stdc++.h>
using namespace std;

#define ull unsigned long long
#define ll long long

void fn()
{
    // fstream myfile;
    // myfile.open("inp.txt", ios::in);
    int n;
    cin >> n;
    vector<int> nums(n);
    for (int i = 0; i < n; i++)
        cin >> nums[i];
    sort(nums.begin(), nums.end(), greater<int>());
    int sol = 0;
    for (int i = 0; i < n; i++)
    {
        if (nums[i] > i)
            sol = i + 1;
        else
            break;
    }
    cout << sol << endl;
}

int main()
{
    int t = 1;
    // cin>>t;
    while (t--)
        fn();
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...