fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3.  
  4. const int MaxN=2e5;
  5. const int MaxA=1e9;
  6. int N, Q, x, p;
  7. int A[MaxN];
  8.  
  9. int main(){
  10. cin>>N>>Q;
  11. for(int n=0; n<N; n+=1)
  12. cin>>A[n];
  13.  
  14. sort(A,A+N);
  15. for(int q=0; q<Q; q+=1){
  16. cin>>x;
  17. cout<< N-( lower_bound(A,A+N,x)-A )<<"\n";
  18. }
  19. }
Success #stdin #stdout 0s 5304KB
stdin
5 5
804289384 846930887 681692778 714636916 957747794
424238336
719885387
649760493
596516650
189641422


stdout
5
3
5
5
5