Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- using namespace std;
- int n, q, tmp;
- vector<int> a;
- int main()
- {
- ios_base::sync_with_stdio(0);
- cin.tie(0);
- cin >> n;
- for (int i = 0; i < n; ++i) {
- cin >> tmp;
- a.push_back(tmp);
- }
- cin >> q;
- while (q--) {
- cin >> tmp;
- cout<<upper_bound(a.begin(), a.end(), tmp) - lower_bound(a.begin(), a.end(), tmp)<<"\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement