Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ll n;
- cin >> n;
- vector <ll> a(n);
- for (ll i = 0; i < n; i++) cin >> a[i];
- sort(a.begin(), a.end());
- ll m;
- cin >> m;
- for (ll i = 0; i < m; i++) {
- ll tmp;
- cin >> tmp;
- ll L = -1;
- ll R = n;
- while (R - L > 1) {
- ll M = (R + L) / 2;
- (a[M] < tmp ? L : R) = M;
- }
- cout << L+1 << " ";
- }
Advertisement
Add Comment
Please, Sign In to add comment