Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main() {
- int n;
- cin >> n;
- vector<int> a(n);
- for (auto &el : a) cin >> el;
- sort(a.begin(), a.end());
- vector<int> b = {a[0]};
- for (int i = 1; i < n; ++i) {
- if (a[i] != a[i - 1]) {
- b.push_back(a[i]);
- }
- }
- n = b.size();
- int k, x;
- cin >> k;
- while (k--) {
- cin >> x;
- cout << lower_bound(b.begin(), b.end(), x) - b.begin() << '\n';
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement