Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <vector>
- #include <algorithm>
- #include <set>
- using namespace std;
- void fastIO() {
- ios_base::sync_with_stdio(false);
- cin.tie(0);
- cout.tie(0);
- }
- int getStick(int k, vector <int> &a) {
- int ind = lower_bound(a.begin(), a.end(), k) - a.begin();
- return ind;
- }
- int main() {
- fastIO();
- int n;
- cin >> n;
- set <int> s;
- vector <int> a;
- for (int st, i = 0; i < n; i++) {
- cin >> st;
- s.insert(st);
- }
- while (s.size() > 0) {
- a.push_back(*s.begin());
- s.erase(s.begin());
- }
- //sort(a.begin(), a.end());
- int k;
- cin >> k;
- for (int person, i = 0; i < k; i++) {
- cin >> person;
- cout << getStick(person, a) << "\n";
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement