Submission #884388

#TimeUsernameProblemLanguageResultExecution timeMemory
884388ElenaBMHindeks (COCI17_hindeks)C++17
40 / 50
162 ms2396 KiB
#include <bits/stdc++.h> using namespace std; int main() { int n; cin>> n; vector<int>v(n); for (int i = 0; i < n; ++i)cin>> v[i]; sort(v.begin(), v.end()); if(v[n-1] == 0){ cout<< 0 << '\n'; return 0; } for (int i = 1; i <= n; ++i){ if (v[n-i] >= i)continue; else{ cout<< i-1 << '\n'; return 0; } } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...