Submission
Status:
[PPPPPPPPPPPP]
Score: 100
User: admin
Problemset: 01.H-index
Language: cpp
Time: 0.374 second
Submitted On: 2025-03-31 01:55:57
#include <bits/stdc++.h>
using namespace std;
int main() {
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int N;
cin >> N;
vector<int> v(N);
for (int i=0; i<N;i++) cin>>v[i];
sort(v.begin(), v.end());
int L = 0;
int R = N-1;
int M;
int X=0;
while (L <= R) {
M = L+(R-L)/2;
int C = N-M;
if (v[M] >= C) {
X = C;
R = M-1;
} else {
L = M+1;
}
}
cout << X;
return 0;
}