fork download
  1. #include<bits/stdc++.h>
  2.  
  3. using namespace std;
  4.  
  5. #define ll long long
  6. #define ld long double
  7. #define vll vector<ll>
  8. #define pb push_back
  9. #define f first
  10. #define se second
  11. #define endl '\n'
  12. #define Left Node << 1
  13. #define Right Node << 1 | 1
  14. #define INF -1e9
  15. #define Fast() {ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL);}
  16.  
  17. void solve()
  18. {
  19. int n, m;
  20. cin >> n >> m;
  21.  
  22. vector<int> a(n);
  23. for (int &it : a)
  24. cin >> it;
  25.  
  26. vector<int> b(m);
  27. for (int &it : b)
  28. cin >> it;
  29.  
  30. sort(a.begin(), a.end());
  31.  
  32. for (int it : b) {
  33. cout << upper_bound(a.begin(), a.end(), it) - a.begin() << ' ';
  34. }
  35. }
  36.  
  37. int main()
  38. {
  39. Fast();
  40.  
  41. int t = 1;
  42. // cin >> t;
  43. while (t--)
  44. {
  45. solve();
  46. }
  47.  
  48. return 0;
  49. }
Success #stdin #stdout 0.01s 5312KB
stdin
Standard input is empty
stdout
Standard output is empty