# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
377247 | marat0210 | Hindeks (COCI17_hindeks) | C++14 | 261 ms | 4332 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n;
cin >>n;
vector <long long> a(n);
for (int i = 0; i < n; ++i) {
cin >>a[i];
}
sort(a.begin(), a.end());
for (int i = n; i >= 0; --i) {
int cnt = (upper_bound(a.begin(), a.end(), i) - a.begin()) - (lower_bound(a.begin(), a.end(), i - 1) - a.begin()) + 1;
if (cnt >= i) {
cout <<i<<endl;
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |