Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<map>
- using namespace std;
- void PrintMap(const map<int, int>& m)
- {
- for (const auto& x : m)
- cout << x.first << " -> " << x.second << endl;
- }
- int main()
- {
- map<int, int> counts;
- int p;
- cin >> p;
- for (int i = 0; i < p; ++i)
- {
- int point;
- cin >> point;
- counts[point] = 0;
- }
- int pr;
- cin >> pr;
- for (int i = 0; i < pr; ++i)
- {
- int begin, end;
- cin >> begin >> end;
- for (auto& x : counts)
- if (x.first >= begin && x.first <= end)
- x.second++;
- }
- PrintMap(counts);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement