#include <bits/stdc++.h>
using namespace std;
typedef long long int lli;
typedef pair<lli,lli> pii;
#define dbg(x) cout<<#x<<" has a value of: "<<x<<"\n";
#define usize(x) (int)(x.size())
#define plist(x) for(int i=0;i<usize(x);i++)cout<<"eleman "<<i<<" = "<<x[i]<<"\n";
#define foreach(x) for(auto item:x)
#define fill(s,x) for(int i=0;i<x;i++)cin>>s[i];
#define in(veriler,a) (veriler.find(a)!=veriler.end())
#define btw(x,y,z) x>=y && x<=z
std::ostream& operator<<(std::ostream& os, pair<int,int> p) {
os << p.first << ", " << p.second;
return os;
}
int main(){
int n;
cin>>n;
vector<int> dizi(n);
for (int i = 0; i < n; i++)
{
cin>>dizi[i];
}
sort(dizi.begin(),dizi.end());
int k=0;
for (int i = n-1; i >=0 ; i--)
{
if(dizi[i]>=n-i)k=n-i;
}
cout<<k<<"\n";
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
5 ms |
376 KB |
Output is correct |
8 |
Correct |
38 ms |
1272 KB |
Output is correct |
9 |
Correct |
190 ms |
5624 KB |
Output is correct |
10 |
Correct |
96 ms |
2936 KB |
Output is correct |