Submission #171629

#TimeUsernameProblemLanguageResultExecution timeMemory
171629ToniBHindeks (COCI17_hindeks)C++14
50 / 50
336 ms5752 KiB
#include <iostream> #include <algorithm> #include <string> using namespace std; int cmp(int x, int y){ return x > y; } int main(){ int n; cin >> n; int sol = 0; int all[n] = {0}; for(int i = 0; i < n; ++i){ cin >> all[i]; } sort(all, all + n, cmp); for(int i = 0; i < n; ++i){ if(all[i] < i + 1){ sol = i; break; } if(i == n - 1){ sol = n; } } cout << sol; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...