# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
377241 | marat0210 | Hindeks (COCI17_hindeks) | C++14 | 254 ms | 4204 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 = 0;
int l = -1, r = n;
while (r - l > 1) {
int m = (r + l) / 2;
if (a[m] >= i) {
r = m;
}
else {
l = m;
}
}
if (cnt >= l) {
cout <<i<<endl;
return 0;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |