Submission #377245

#TimeUsernameProblemLanguageResultExecution timeMemory
377245marat0210Hindeks (COCI17_hindeks)C++14
5 / 50
257 ms4588 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 = (upper_bound(a.begin(), a.end(), i) - a.begin()) - (lower_bound(a.begin(), a.end(), i - 1) - a.begin()); if (cnt >= i) { cout <<i<<endl; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...