Submission #377241

#TimeUsernameProblemLanguageResultExecution timeMemory
377241marat0210Hindeks (COCI17_hindeks)C++14
20 / 50
254 ms4204 KiB
#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 timeMemoryGrader output
Fetching results...